Merge pull request #14906 from kubernetes/dependencies/update-1672380550

Update dependencies
This commit is contained in:
Kubernetes Prow Robot 2022-12-30 00:35:31 -08:00 committed by GitHub
commit 8456842506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 234 additions and 65 deletions

6
go.mod
View File

@ -14,7 +14,7 @@ require (
github.com/Masterminds/sprig/v3 v3.2.3
github.com/apparentlymart/go-cidr v1.1.0
github.com/aws/amazon-ec2-instance-selector/v2 v2.4.0
github.com/aws/aws-sdk-go v1.44.166
github.com/aws/aws-sdk-go v1.44.170
github.com/blang/semver/v4 v4.0.0
github.com/cert-manager/cert-manager v1.10.1
github.com/digitalocean/godo v1.93.0
@ -27,7 +27,7 @@ require (
github.com/google/go-tpm-tools v0.3.10
github.com/google/uuid v1.3.0
github.com/gophercloud/gophercloud v1.1.1
github.com/hetznercloud/hcloud-go v1.38.0
github.com/hetznercloud/hcloud-go v1.39.0
github.com/jacksontj/memberlistmesh v0.0.0-20190905163944-93462b9d2bb7
github.com/mitchellh/mapstructure v1.5.0
github.com/pelletier/go-toml v1.9.5
@ -43,7 +43,7 @@ require (
github.com/weaveworks/mesh v0.0.0-20191105120815-58dbcc3e8e63
go.uber.org/multierr v1.9.0
golang.org/x/crypto v0.4.0
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15
golang.org/x/exp v0.0.0-20221229233502-02c3fc3b3eb4
golang.org/x/net v0.4.0
golang.org/x/oauth2 v0.3.0
golang.org/x/sync v0.1.0

12
go.sum
View File

@ -122,8 +122,8 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aws/amazon-ec2-instance-selector/v2 v2.4.0 h1:9l68/pwVYm6EOAeBmoVUL4ekw6VlbwtPyX9/F+IpMxQ=
github.com/aws/amazon-ec2-instance-selector/v2 v2.4.0/go.mod h1:AEJrtkLkCkfIBIazidrVrgZqaXl+9dxI/wRgjdw+7G0=
github.com/aws/aws-sdk-go v1.44.166 h1:oAn/wJYFoSF2e9iJYkqTlC9IY15ufPnKR1Zt8oZblhg=
github.com/aws/aws-sdk-go v1.44.166/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.170 h1:9dGTB7XRHzDB8+1NOIg/QS/DhCWgIM/iMC1dlZv42CE=
github.com/aws/aws-sdk-go v1.44.170/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@ -428,8 +428,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/hashicorp/memberlist v0.1.4/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/memberlist v0.3.1 h1:MXgUXLqva1QvpVEDQW1IQLG0wivQAtmFlHRQ+1vWZfM=
github.com/hashicorp/memberlist v0.3.1/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
github.com/hetznercloud/hcloud-go v1.38.0 h1:K6Pd/mMdcLfBhvwG39qyAaacp4pCS3dKa8gChmLKxLg=
github.com/hetznercloud/hcloud-go v1.38.0/go.mod h1:mepQwR6va27S3UQthaEPGS86jtzSY9xWL1e9dyxXpgA=
github.com/hetznercloud/hcloud-go v1.39.0 h1:RUlzI458nGnPR6dlcZlrsGXYC1hQlFbKdm8tVtEQQB0=
github.com/hetznercloud/hcloud-go v1.39.0/go.mod h1:mepQwR6va27S3UQthaEPGS86jtzSY9xWL1e9dyxXpgA=
github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
@ -767,8 +767,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 h1:5oN1Pz/eDhCpbMbLstvIPa0b/BEQo6g6nwV3pLjfM6w=
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20221229233502-02c3fc3b3eb4 h1:FJ366zx98Mq6JL8dYkXwSHeGwc2wM9NsxFerYtY70rY=
golang.org/x/exp v0.0.0-20221229233502-02c3fc3b3eb4/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=

View File

@ -35,7 +35,7 @@ require (
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/aws/aws-sdk-go v1.44.166 // indirect
github.com/aws/aws-sdk-go v1.44.170 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
@ -113,7 +113,7 @@ require (
go.opencensus.io v0.24.0 // indirect
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.4.0 // indirect
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 // indirect
golang.org/x/exp v0.0.0-20221229233502-02c3fc3b3eb4 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/oauth2 v0.3.0 // indirect

View File

@ -305,8 +305,8 @@ github.com/aws/aws-sdk-go v1.31.6/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU
github.com/aws/aws-sdk-go v1.31.12/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48=
github.com/aws/aws-sdk-go v1.37.22/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/aws/aws-sdk-go v1.44.166 h1:oAn/wJYFoSF2e9iJYkqTlC9IY15ufPnKR1Zt8oZblhg=
github.com/aws/aws-sdk-go v1.44.166/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.170 h1:9dGTB7XRHzDB8+1NOIg/QS/DhCWgIM/iMC1dlZv42CE=
github.com/aws/aws-sdk-go v1.44.170/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
github.com/bazelbuild/buildtools v0.0.0-20190917191645-69366ca98f89/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU=
github.com/bazelbuild/buildtools v0.0.0-20200922170545-10384511ce98/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU=
@ -2087,8 +2087,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 h1:5oN1Pz/eDhCpbMbLstvIPa0b/BEQo6g6nwV3pLjfM6w=
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20221229233502-02c3fc3b3eb4 h1:FJ366zx98Mq6JL8dYkXwSHeGwc2wM9NsxFerYtY70rY=
golang.org/x/exp v0.0.0-20221229233502-02c3fc3b3eb4/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=

View File

@ -38,7 +38,7 @@ const (
EuWest3RegionID = "eu-west-3" // Europe (Paris).
MeCentral1RegionID = "me-central-1" // Middle East (UAE).
MeSouth1RegionID = "me-south-1" // Middle East (Bahrain).
SaEast1RegionID = "sa-east-1" // South America (Sao Paulo).
SaEast1RegionID = "sa-east-1" // South America (São Paulo).
UsEast1RegionID = "us-east-1" // US East (N. Virginia).
UsEast2RegionID = "us-east-2" // US East (Ohio).
UsWest1RegionID = "us-west-1" // US West (N. California).
@ -206,7 +206,7 @@ var awsPartition = partition{
Description: "Middle East (Bahrain)",
},
"sa-east-1": region{
Description: "South America (Sao Paulo)",
Description: "South America (São Paulo)",
},
"us-east-1": region{
Description: "US East (N. Virginia)",
@ -17531,6 +17531,9 @@ var awsPartition = partition{
endpointKey{
Region: "ap-southeast-2",
}: endpoint{},
endpointKey{
Region: "ap-southeast-3",
}: endpoint{},
endpointKey{
Region: "ca-central-1",
}: endpoint{},
@ -23055,6 +23058,15 @@ var awsPartition = partition{
}: endpoint{
Hostname: "servicediscovery.ap-south-1.amazonaws.com",
},
endpointKey{
Region: "ap-south-2",
}: endpoint{},
endpointKey{
Region: "ap-south-2",
Variant: dualStackVariant,
}: endpoint{
Hostname: "servicediscovery.ap-south-2.amazonaws.com",
},
endpointKey{
Region: "ap-southeast-1",
}: endpoint{},
@ -23115,6 +23127,15 @@ var awsPartition = partition{
}: endpoint{
Hostname: "servicediscovery.eu-central-1.amazonaws.com",
},
endpointKey{
Region: "eu-central-2",
}: endpoint{},
endpointKey{
Region: "eu-central-2",
Variant: dualStackVariant,
}: endpoint{
Hostname: "servicediscovery.eu-central-2.amazonaws.com",
},
endpointKey{
Region: "eu-north-1",
}: endpoint{},
@ -23133,6 +23154,15 @@ var awsPartition = partition{
}: endpoint{
Hostname: "servicediscovery.eu-south-1.amazonaws.com",
},
endpointKey{
Region: "eu-south-2",
}: endpoint{},
endpointKey{
Region: "eu-south-2",
Variant: dualStackVariant,
}: endpoint{
Hostname: "servicediscovery.eu-south-2.amazonaws.com",
},
endpointKey{
Region: "eu-west-1",
}: endpoint{},
@ -23679,6 +23709,12 @@ var awsPartition = partition{
endpointKey{
Region: "ca-central-1",
}: endpoint{},
endpointKey{
Region: "ca-central-1",
Variant: fipsVariant,
}: endpoint{
Hostname: "sms-voice-fips.ca-central-1.amazonaws.com",
},
endpointKey{
Region: "eu-central-1",
}: endpoint{},
@ -23688,12 +23724,51 @@ var awsPartition = partition{
endpointKey{
Region: "eu-west-2",
}: endpoint{},
endpointKey{
Region: "fips-ca-central-1",
}: endpoint{
Hostname: "sms-voice-fips.ca-central-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "ca-central-1",
},
Deprecated: boxedTrue,
},
endpointKey{
Region: "fips-us-east-1",
}: endpoint{
Hostname: "sms-voice-fips.us-east-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-east-1",
},
Deprecated: boxedTrue,
},
endpointKey{
Region: "fips-us-west-2",
}: endpoint{
Hostname: "sms-voice-fips.us-west-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-west-2",
},
Deprecated: boxedTrue,
},
endpointKey{
Region: "us-east-1",
}: endpoint{},
endpointKey{
Region: "us-east-1",
Variant: fipsVariant,
}: endpoint{
Hostname: "sms-voice-fips.us-east-1.amazonaws.com",
},
endpointKey{
Region: "us-west-2",
}: endpoint{},
endpointKey{
Region: "us-west-2",
Variant: fipsVariant,
}: endpoint{
Hostname: "sms-voice-fips.us-west-2.amazonaws.com",
},
},
},
"snowball": service{
@ -26199,6 +26274,21 @@ var awsPartition = partition{
endpointKey{
Region: "ca-central-1",
}: endpoint{},
endpointKey{
Region: "ca-central-1",
Variant: fipsVariant,
}: endpoint{
Hostname: "voice-chime-fips.ca-central-1.amazonaws.com",
},
endpointKey{
Region: "ca-central-1-fips",
}: endpoint{
Hostname: "voice-chime-fips.ca-central-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "ca-central-1",
},
Deprecated: boxedTrue,
},
endpointKey{
Region: "eu-central-1",
}: endpoint{},
@ -26215,12 +26305,12 @@ var awsPartition = partition{
Region: "us-east-1",
Variant: fipsVariant,
}: endpoint{
Hostname: "fips.voice-chime.us-east-1.amazonaws.com",
Hostname: "voice-chime-fips.us-east-1.amazonaws.com",
},
endpointKey{
Region: "us-east-1-fips",
}: endpoint{
Hostname: "fips.voice-chime.us-east-1.amazonaws.com",
Hostname: "voice-chime-fips.us-east-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-east-1",
},
@ -26233,12 +26323,12 @@ var awsPartition = partition{
Region: "us-west-2",
Variant: fipsVariant,
}: endpoint{
Hostname: "fips.voice-chime.us-west-2.amazonaws.com",
Hostname: "voice-chime-fips.us-west-2.amazonaws.com",
},
endpointKey{
Region: "us-west-2-fips",
}: endpoint{
Hostname: "fips.voice-chime.us-west-2.amazonaws.com",
Hostname: "voice-chime-fips.us-west-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-west-2",
},
@ -33121,6 +33211,13 @@ var awsusgovPartition = partition{
},
},
},
"pi": service{
Endpoints: serviceEndpoints{
endpointKey{
Region: "us-gov-east-1",
}: endpoint{},
},
},
"pinpoint": service{
Defaults: endpointDefaults{
defaultKey{}: endpoint{
@ -34166,9 +34263,24 @@ var awsusgovPartition = partition{
},
"sms-voice": service{
Endpoints: serviceEndpoints{
endpointKey{
Region: "fips-us-gov-west-1",
}: endpoint{
Hostname: "sms-voice-fips.us-gov-west-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-gov-west-1",
},
Deprecated: boxedTrue,
},
endpointKey{
Region: "us-gov-west-1",
}: endpoint{},
endpointKey{
Region: "us-gov-west-1",
Variant: fipsVariant,
}: endpoint{
Hostname: "sms-voice-fips.us-gov-west-1.amazonaws.com",
},
},
},
"snowball": service{

View File

@ -5,4 +5,4 @@ package aws
const SDKName = "aws-sdk-go"
// SDKVersion is the version of this SDK
const SDKVersion = "1.44.166"
const SDKVersion = "1.44.170"

View File

@ -13,10 +13,17 @@ import (
"github.com/aws/aws-sdk-go/private/protocol/json/jsonutil"
)
const (
awsQueryError = "x-amzn-query-error"
// A valid header example - "x-amzn-query-error": "<QueryErrorCode>;<ErrorType>"
awsQueryErrorPartsCount = 2
)
// UnmarshalTypedError provides unmarshaling errors API response errors
// for both typed and untyped errors.
type UnmarshalTypedError struct {
exceptions map[string]func(protocol.ResponseMetadata) error
queryExceptions map[string]func(protocol.ResponseMetadata, string) error
}
// NewUnmarshalTypedError returns an UnmarshalTypedError initialized for the
@ -24,6 +31,21 @@ type UnmarshalTypedError struct {
func NewUnmarshalTypedError(exceptions map[string]func(protocol.ResponseMetadata) error) *UnmarshalTypedError {
return &UnmarshalTypedError{
exceptions: exceptions,
queryExceptions: map[string]func(protocol.ResponseMetadata, string) error{},
}
}
func NewUnmarshalTypedErrorWithOptions(exceptions map[string]func(protocol.ResponseMetadata) error, optFns ...func(*UnmarshalTypedError)) *UnmarshalTypedError {
unmarshaledError := NewUnmarshalTypedError(exceptions)
for _, fn := range optFns {
fn(unmarshaledError)
}
return unmarshaledError
}
func WithQueryCompatibility(queryExceptions map[string]func(protocol.ResponseMetadata, string) error) func(*UnmarshalTypedError) {
return func(typedError *UnmarshalTypedError) {
typedError.queryExceptions = queryExceptions
}
}
@ -50,18 +72,32 @@ func (u *UnmarshalTypedError) UnmarshalError(
code := codeParts[len(codeParts)-1]
msg := jsonErr.Message
queryCodeParts := queryCodeParts(resp, u)
if fn, ok := u.exceptions[code]; ok {
// If exception code is know, use associated constructor to get a value
// If query-compatible exceptions are found and query-error-header is found,
// then use associated constructor to get exception with query error code.
//
// If exception code is known, use associated constructor to get a value
// for the exception that the JSON body can be unmarshaled into.
v := fn(respMeta)
var v error
queryErrFn, queryExceptionsFound := u.queryExceptions[code]
if len(queryCodeParts) == awsQueryErrorPartsCount && queryExceptionsFound {
v = queryErrFn(respMeta, queryCodeParts[0])
} else {
v = fn(respMeta)
}
err := jsonutil.UnmarshalJSONCaseInsensitive(v, body)
if err != nil {
return nil, err
}
return v, nil
}
if len(queryCodeParts) == awsQueryErrorPartsCount && len(u.queryExceptions) > 0 {
code = queryCodeParts[0]
}
// fallback to unmodeled generic exceptions
return awserr.NewRequestFailure(
awserr.New(code, msg, nil),
@ -70,6 +106,16 @@ func (u *UnmarshalTypedError) UnmarshalError(
), nil
}
// A valid header example - "x-amzn-query-error": "<QueryErrorCode>;<ErrorType>"
func queryCodeParts(resp *http.Response, u *UnmarshalTypedError) []string {
queryCodeHeader := resp.Header.Get(awsQueryError)
var queryCodeParts []string
if queryCodeHeader != "" && len(u.queryExceptions) > 0 {
queryCodeParts = strings.Split(queryCodeHeader, ";")
}
return queryCodeParts
}
// UnmarshalErrorHandler is a named request handler for unmarshaling jsonrpc
// protocol request errors
var UnmarshalErrorHandler = request.NamedHandler{

View File

@ -241,10 +241,10 @@ func (c *FloatingIPClient) Create(ctx context.Context, opts FloatingIPCreateOpts
Name: opts.Name,
}
if opts.HomeLocation != nil {
reqBody.HomeLocation = String(opts.HomeLocation.Name)
reqBody.HomeLocation = Ptr(opts.HomeLocation.Name)
}
if opts.Server != nil {
reqBody.Server = Int(opts.Server.ID)
reqBody.Server = Ptr(opts.Server.ID)
}
if opts.Labels != nil {
reqBody.Labels = &opts.Labels

View File

@ -2,4 +2,4 @@
package hcloud
// Version is the library's version following Semantic Versioning.
const Version = "1.38.0"
const Version = "1.39.0" // x-release-please-version

View File

@ -2,17 +2,27 @@ package hcloud
import "time"
// Ptr returns a pointer to p.
func Ptr[T any](p T) *T {
return &p
}
// String returns a pointer to the passed string s.
func String(s string) *string { return &s }
//
// Deprecated: Use [Ptr] instead.
func String(s string) *string { return Ptr(s) }
// Int returns a pointer to the passed integer i.
func Int(i int) *int { return &i }
//
// Deprecated: Use [Ptr] instead.
func Int(i int) *int { return Ptr(i) }
// Bool returns a pointer to the passed bool b.
func Bool(b bool) *bool { return &b }
//
// Deprecated: Use [Ptr] instead.
func Bool(b bool) *bool { return Ptr(b) }
// Duration returns a pointer to the passed time.Duration d.
func Duration(d time.Duration) *time.Duration { return &d }
func intSlice(is []int) *[]int { return &is }
func stringSlice(ss []string) *[]string { return &ss }
//
// Deprecated: Use [Ptr] instead.
func Duration(d time.Duration) *time.Duration { return Ptr(d) }

View File

@ -222,7 +222,7 @@ func (c *ImageClient) Update(ctx context.Context, image *Image, opts ImageUpdate
Description: opts.Description,
}
if opts.Type != "" {
reqBody.Type = String(string(opts.Type))
reqBody.Type = Ptr(string(opts.Type))
}
if opts.Labels != nil {
reqBody.Labels = &opts.Labels

View File

@ -491,7 +491,6 @@ type LoadBalancerCreateResult struct {
func (c *LoadBalancerClient) Create(ctx context.Context, opts LoadBalancerCreateOpts) (LoadBalancerCreateResult, *Response, error) {
reqBody := loadBalancerCreateOptsToSchema(opts)
reqBodyData, err := json.Marshal(reqBody)
if err != nil {
return LoadBalancerCreateResult{}, nil, err
}
@ -865,7 +864,7 @@ func (c *LoadBalancerClient) AttachToNetwork(ctx context.Context, loadBalancer *
Network: opts.Network.ID,
}
if opts.IP != nil {
reqBody.IP = String(opts.IP.String())
reqBody.IP = Ptr(opts.IP.String())
}
reqBodyData, err := json.Marshal(reqBody)
if err != nil {

View File

@ -56,7 +56,8 @@ type FloatingIPTypePricing struct {
// PrimaryIPTypePricing defines the schema of pricing information for a primary IP
// type at a datacenter.
type PrimaryIPTypePricing struct {
Datacenter string
Datacenter string // Deprecated: the API does not return pricing for the individual DCs anymore
Location string
Hourly PrimaryIPPrice
Monthly PrimaryIPPrice
}

View File

@ -721,7 +721,7 @@ func PricingFromSchema(s schema.Pricing) Pricing {
var pricings []PrimaryIPTypePricing
for _, price := range primaryIPType.Prices {
p := PrimaryIPTypePricing{
Datacenter: price.Datacenter,
Location: price.Location,
Monthly: PrimaryIPPrice{
Net: price.PriceMonthly.Net,
Gross: price.PriceMonthly.Gross,
@ -881,19 +881,19 @@ func loadBalancerCreateOptsToSchema(opts LoadBalancerCreateOpts) schema.LoadBala
}
if opts.Location != nil {
if opts.Location.ID != 0 {
req.Location = String(strconv.Itoa(opts.Location.ID))
req.Location = Ptr(strconv.Itoa(opts.Location.ID))
} else {
req.Location = String(opts.Location.Name)
req.Location = Ptr(opts.Location.Name)
}
}
if opts.NetworkZone != "" {
req.NetworkZone = String(string(opts.NetworkZone))
req.NetworkZone = Ptr(string(opts.NetworkZone))
}
if opts.Labels != nil {
req.Labels = &opts.Labels
}
if opts.Network != nil {
req.Network = Int(opts.Network.ID)
req.Network = Ptr(opts.Network.ID)
}
for _, target := range opts.Targets {
schemaTarget := schema.LoadBalancerCreateRequestTarget{
@ -927,7 +927,7 @@ func loadBalancerCreateOptsToSchema(opts LoadBalancerCreateOpts) schema.LoadBala
}
if service.HTTP.CookieLifetime != nil {
if sec := service.HTTP.CookieLifetime.Seconds(); sec != 0 {
schemaService.HTTP.CookieLifetime = Int(int(sec))
schemaService.HTTP.CookieLifetime = Ptr(int(sec))
}
}
if service.HTTP.Certificates != nil {
@ -945,10 +945,10 @@ func loadBalancerCreateOptsToSchema(opts LoadBalancerCreateOpts) schema.LoadBala
Retries: service.HealthCheck.Retries,
}
if service.HealthCheck.Interval != nil {
schemaHealthCheck.Interval = Int(int(service.HealthCheck.Interval.Seconds()))
schemaHealthCheck.Interval = Ptr(int(service.HealthCheck.Interval.Seconds()))
}
if service.HealthCheck.Timeout != nil {
schemaHealthCheck.Timeout = Int(int(service.HealthCheck.Timeout.Seconds()))
schemaHealthCheck.Timeout = Ptr(int(service.HealthCheck.Timeout.Seconds()))
}
if service.HealthCheck.HTTP != nil {
schemaHealthCheckHTTP := &schema.LoadBalancerCreateRequestServiceHealthCheckHTTP{
@ -983,7 +983,7 @@ func loadBalancerAddServiceOptsToSchema(opts LoadBalancerAddServiceOpts) schema.
StickySessions: opts.HTTP.StickySessions,
}
if opts.HTTP.CookieLifetime != nil {
req.HTTP.CookieLifetime = Int(int(opts.HTTP.CookieLifetime.Seconds()))
req.HTTP.CookieLifetime = Ptr(int(opts.HTTP.CookieLifetime.Seconds()))
}
if opts.HTTP.Certificates != nil {
certificates := []int{}
@ -1000,10 +1000,10 @@ func loadBalancerAddServiceOptsToSchema(opts LoadBalancerAddServiceOpts) schema.
Retries: opts.HealthCheck.Retries,
}
if opts.HealthCheck.Interval != nil {
req.HealthCheck.Interval = Int(int(opts.HealthCheck.Interval.Seconds()))
req.HealthCheck.Interval = Ptr(int(opts.HealthCheck.Interval.Seconds()))
}
if opts.HealthCheck.Timeout != nil {
req.HealthCheck.Timeout = Int(int(opts.HealthCheck.Timeout.Seconds()))
req.HealthCheck.Timeout = Ptr(int(opts.HealthCheck.Timeout.Seconds()))
}
if opts.HealthCheck.HTTP != nil {
req.HealthCheck.HTTP = &schema.LoadBalancerActionAddServiceRequestHealthCheckHTTP{
@ -1026,7 +1026,7 @@ func loadBalancerUpdateServiceOptsToSchema(opts LoadBalancerUpdateServiceOpts) s
Proxyprotocol: opts.Proxyprotocol,
}
if opts.Protocol != "" {
req.Protocol = String(string(opts.Protocol))
req.Protocol = Ptr(string(opts.Protocol))
}
if opts.HTTP != nil {
req.HTTP = &schema.LoadBalancerActionUpdateServiceRequestHTTP{
@ -1035,7 +1035,7 @@ func loadBalancerUpdateServiceOptsToSchema(opts LoadBalancerUpdateServiceOpts) s
StickySessions: opts.HTTP.StickySessions,
}
if opts.HTTP.CookieLifetime != nil {
req.HTTP.CookieLifetime = Int(int(opts.HTTP.CookieLifetime.Seconds()))
req.HTTP.CookieLifetime = Ptr(int(opts.HTTP.CookieLifetime.Seconds()))
}
if opts.HTTP.Certificates != nil {
certificates := []int{}
@ -1051,13 +1051,13 @@ func loadBalancerUpdateServiceOptsToSchema(opts LoadBalancerUpdateServiceOpts) s
Retries: opts.HealthCheck.Retries,
}
if opts.HealthCheck.Interval != nil {
req.HealthCheck.Interval = Int(int(opts.HealthCheck.Interval.Seconds()))
req.HealthCheck.Interval = Ptr(int(opts.HealthCheck.Interval.Seconds()))
}
if opts.HealthCheck.Timeout != nil {
req.HealthCheck.Timeout = Int(int(opts.HealthCheck.Timeout.Seconds()))
req.HealthCheck.Timeout = Ptr(int(opts.HealthCheck.Timeout.Seconds()))
}
if opts.HealthCheck.Protocol != "" {
req.HealthCheck.Protocol = String(string(opts.HealthCheck.Protocol))
req.HealthCheck.Protocol = Ptr(string(opts.HealthCheck.Protocol))
}
if opts.HealthCheck.HTTP != nil {
req.HealthCheck.HTTP = &schema.LoadBalancerActionUpdateServiceRequestHealthCheckHTTP{

View File

@ -97,7 +97,8 @@ type PricingGetResponse struct {
// PricingPrimaryIPTypePrice defines the schema of pricing information for a primary IP
// type at a datacenter.
type PricingPrimaryIPTypePrice struct {
Datacenter string `json:"datacenter"`
Datacenter string `json:"datacenter"` // Deprecated: the API does not return pricing for the individual DCs anymore
Location string `json:"location"`
PriceHourly Price `json:"price_hourly"`
PriceMonthly Price `json:"price_monthly"`
}

View File

@ -664,7 +664,7 @@ func (c *ServerClient) CreateImage(ctx context.Context, server *Server, opts *Se
reqBody.Description = opts.Description
}
if opts.Type != "" {
reqBody.Type = String(string(opts.Type))
reqBody.Type = Ptr(string(opts.Type))
}
if opts.Labels != nil {
reqBody.Labels = &opts.Labels
@ -707,7 +707,7 @@ type ServerEnableRescueResult struct {
// EnableRescue enables rescue mode for a server.
func (c *ServerClient) EnableRescue(ctx context.Context, server *Server, opts ServerEnableRescueOpts) (ServerEnableRescueResult, *Response, error) {
reqBody := schema.ServerActionEnableRescueRequest{
Type: String(string(opts.Type)),
Type: Ptr(string(opts.Type)),
}
for _, sshKey := range opts.SSHKeys {
reqBody.SSHKeys = append(reqBody.SSHKeys, sshKey.ID)
@ -832,7 +832,7 @@ func (c *ServerClient) DetachISO(ctx context.Context, server *Server) (*Action,
func (c *ServerClient) EnableBackup(ctx context.Context, server *Server, window string) (*Action, *Response, error) {
reqBody := schema.ServerActionEnableBackupRequest{}
if window != "" {
reqBody.BackupWindow = String(window)
reqBody.BackupWindow = Ptr(window)
}
reqBodyData, err := json.Marshal(reqBody)
if err != nil {
@ -985,10 +985,10 @@ func (c *ServerClient) AttachToNetwork(ctx context.Context, server *Server, opts
Network: opts.Network.ID,
}
if opts.IP != nil {
reqBody.IP = String(opts.IP.String())
reqBody.IP = Ptr(opts.IP.String())
}
for _, aliasIP := range opts.AliasIPs {
reqBody.AliasIPs = append(reqBody.AliasIPs, String(aliasIP.String()))
reqBody.AliasIPs = append(reqBody.AliasIPs, Ptr(aliasIP.String()))
}
reqBodyData, err := json.Marshal(reqBody)
if err != nil {

View File

@ -210,7 +210,7 @@ func (c *VolumeClient) Create(ctx context.Context, opts VolumeCreateOpts) (Volum
reqBody.Labels = &opts.Labels
}
if opts.Server != nil {
reqBody.Server = Int(opts.Server.ID)
reqBody.Server = Ptr(opts.Server.ID)
}
if opts.Location != nil {
if opts.Location.ID != 0 {

6
vendor/modules.txt generated vendored
View File

@ -91,7 +91,7 @@ github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes
github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector
github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector/outputs
github.com/aws/amazon-ec2-instance-selector/v2/pkg/sorter
# github.com/aws/aws-sdk-go v1.44.166
# github.com/aws/aws-sdk-go v1.44.170
## explicit; go 1.11
github.com/aws/aws-sdk-go/aws
github.com/aws/aws-sdk-go/aws/arn
@ -528,7 +528,7 @@ github.com/hashicorp/hcl/json/token
# github.com/hashicorp/memberlist v0.3.1
## explicit; go 1.12
github.com/hashicorp/memberlist
# github.com/hetznercloud/hcloud-go v1.38.0
# github.com/hetznercloud/hcloud-go v1.39.0
## explicit; go 1.18
github.com/hetznercloud/hcloud-go/hcloud
github.com/hetznercloud/hcloud-go/hcloud/internal/instrumentation
@ -875,7 +875,7 @@ golang.org/x/crypto/scrypt
golang.org/x/crypto/ssh
golang.org/x/crypto/ssh/agent
golang.org/x/crypto/ssh/internal/bcrypt_pbkdf
# golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15
# golang.org/x/exp v0.0.0-20221229233502-02c3fc3b3eb4
## explicit; go 1.18
golang.org/x/exp/constraints
# golang.org/x/mod v0.6.0