From 37a1d71ac5753965262aa73867190f35dd93dfb9 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sat, 6 Jul 2024 04:55:50 -0700 Subject: [PATCH] Update deps Signed-off-by: Tamal Saha --- go.mod | 24 +- go.sum | 58 ++-- vendor/cloud.google.com/go/auth/CHANGES.md | 27 ++ vendor/cloud.google.com/go/auth/auth.go | 143 +++++++- .../go/auth/credentials/compute.go | 7 +- .../go/auth/credentials/detect.go | 18 +- .../go/auth/httptransport/httptransport.go | 9 + .../go/auth/internal/transport/cba.go | 6 +- .../go/auth/internal/transport/transport.go | 27 ++ .../cloud.google.com/go/auth/threelegged.go | 3 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 65 ++++ .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws/aws-sdk-go/service/ec2/api.go | 130 +++++-- .../gax-go/v2/.release-please-manifest.json | 2 +- .../googleapis/gax-go/v2/CHANGES.md | 7 + .../googleapis/gax-go/v2/apierror/apierror.go | 4 +- .../github.com/googleapis/gax-go/v2/header.go | 31 +- .../googleapis/gax-go/v2/internal/version.go | 2 +- .../hashicorp/go-retryablehttp/.go-version | 1 - .../hashicorp/go-retryablehttp/CHANGELOG.md | 28 +- .../hashicorp/go-retryablehttp/CODEOWNERS | 2 +- .../hashicorp/go-retryablehttp/Makefile | 2 +- .../hashicorp/go-retryablehttp/README.md | 2 +- .../go-retryablehttp/cert_error_go119.go | 14 - .../go-retryablehttp/cert_error_go120.go | 14 - .../hashicorp/go-retryablehttp/client.go | 157 ++------- vendor/github.com/linode/linodego/account.go | 5 +- .../linode/linodego/account_availability.go | 39 +-- .../linode/linodego/account_betas.go | 49 +-- .../linode/linodego/account_child.go | 3 + .../linode/linodego/account_events.go | 43 +-- .../linode/linodego/account_invoices.go | 62 +--- .../linode/linodego/account_logins.go | 34 +- .../linode/linodego/account_notifications.go | 27 +- .../linode/linodego/account_oauth_client.go | 69 +--- .../linode/linodego/account_payments.go | 45 +-- .../linode/linodego/account_settings.go | 18 +- .../linode/linodego/account_transfer.go | 6 +- .../linode/linodego/account_user_grants.go | 24 +- .../linode/linodego/account_users.go | 65 +--- vendor/github.com/linode/linodego/betas.go | 38 +-- .../github.com/linode/linodego/databases.go | 132 +------- .../linode/linodego/domain_records.go | 68 +--- vendor/github.com/linode/linodego/domains.go | 70 +--- .../linode/linodego/firewall_devices.go | 53 +-- .../linode/linodego/request_helpers.go | 20 +- .../api/compute/v1/compute-api.json | 128 ++++++- .../api/compute/v1/compute-gen.go | 318 ++++++++++++++++-- .../api/compute/v1/compute3-gen.go | 5 +- .../api/internal/gensupport/resumable.go | 4 + .../google.golang.org/api/internal/version.go | 2 +- .../identity.k8s.appscode.com_siteinfos.yaml | 50 +++ vendor/modules.txt | 28 +- 53 files changed, 1149 insertions(+), 1041 deletions(-) delete mode 100644 vendor/github.com/hashicorp/go-retryablehttp/.go-version delete mode 100644 vendor/github.com/hashicorp/go-retryablehttp/cert_error_go119.go delete mode 100644 vendor/github.com/hashicorp/go-retryablehttp/cert_error_go120.go diff --git a/go.mod b/go.mod index c40abce7..6b555ae8 100644 --- a/go.mod +++ b/go.mod @@ -9,11 +9,11 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 github.com/JamesClonk/vultr v2.0.2+incompatible - github.com/aws/aws-sdk-go v1.54.6 + github.com/aws/aws-sdk-go v1.54.15 github.com/digitalocean/godo v1.118.0 github.com/gogo/protobuf v1.3.2 github.com/google/gofuzz v1.2.0 - github.com/linode/linodego v1.36.0 + github.com/linode/linodego v1.36.1 github.com/packethost/packngo v0.31.0 github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.1 @@ -22,18 +22,18 @@ require ( gomodules.xyz/flags v0.1.3 gomodules.xyz/logs v0.0.7 gomodules.xyz/x v0.0.17 - google.golang.org/api v0.185.0 - k8s.io/apimachinery v0.30.1 - k8s.io/client-go v0.30.1 + google.golang.org/api v0.187.0 + k8s.io/apimachinery v0.30.2 + k8s.io/client-go v0.30.2 k8s.io/klog/v2 v2.130.1 - kmodules.xyz/client-go v0.30.8 + kmodules.xyz/client-go v0.30.9 kmodules.xyz/crd-schema-fuzz v0.29.1 - kmodules.xyz/resource-metadata v0.18.9 + kmodules.xyz/resource-metadata v0.18.10 sigs.k8s.io/yaml v1.4.0 ) require ( - cloud.google.com/go/auth v0.5.1 // indirect + cloud.google.com/go/auth v0.6.1 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect cloud.google.com/go/compute/metadata v0.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect @@ -73,9 +73,9 @@ require ( github.com/google/s2a-go v0.1.7 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.4 // indirect + github.com/googleapis/gax-go/v2 v2.12.5 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-retryablehttp v0.7.7 // indirect + github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef // indirect github.com/huandu/xstrings v1.4.0 // indirect github.com/imdario/mergo v0.3.16 // indirect @@ -130,14 +130,14 @@ require ( gomodules.xyz/pointer v0.1.0 // indirect gomodules.xyz/sets v0.2.1 // indirect gomodules.xyz/wait v0.2.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.66.6 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.30.1 // indirect + k8s.io/api v0.30.2 // indirect k8s.io/apiextensions-apiserver v0.30.1 // indirect k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect diff --git a/go.sum b/go.sum index 19be0e04..7f9cfcbe 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go/auth v0.5.1 h1:0QNO7VThG54LUzKiQxv8C6x1YX7lUrzlAa1nVLF8CIw= -cloud.google.com/go/auth v0.5.1/go.mod h1:vbZT8GjzDf3AVqCcQmqeeM32U9HBFc32vVVAbwDsa6s= +cloud.google.com/go/auth v0.6.1 h1:T0Zw1XM5c1GlpN2HYr2s+m3vr1p2wy+8VN+Z1FKxW38= +cloud.google.com/go/auth v0.6.1/go.mod h1:eFHG7zDzbXHKmjJddFG/rBlcGp6t25SwRUiEQSlO4x4= cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -56,8 +56,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.54.6 h1:HEYUib3yTt8E6vxjMWM3yAq5b+qjj/6aKA62mkgux9g= -github.com/aws/aws-sdk-go v1.54.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.54.15 h1:ErgCEVbzuSfuZl9nR+g8FFnzjgeJ/AqAGOEWn6tgAHo= +github.com/aws/aws-sdk-go v1.54.15/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= 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= @@ -213,8 +213,8 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfF github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.12.4 h1:9gWcmF85Wvq4ryPFvGFaOgPIs1AQX0d0bcbGw4Z96qg= -github.com/googleapis/gax-go/v2 v2.12.4/go.mod h1:KYEYLorsnIGDi/rPC8b5TdlB9kbKoFubselGIoBMCwI= +github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= +github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -226,13 +226,13 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= -github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= -github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= +github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA= +github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= @@ -291,8 +291,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/linode/linodego v1.36.0 h1:AeFkL3cNtiirEiS9gxzNUUaZafFHhNvVpeyuokmKTu8= -github.com/linode/linodego v1.36.0/go.mod h1:7MDOCz/DXckUEByLaXEwVBn6yHuvjoT7zVhp9Tr9OS0= +github.com/linode/linodego v1.36.1 h1:lxYBKWJCk6m9p/OdHQlgteyj4S0eglq3glmK16QxUHY= +github.com/linode/linodego v1.36.1/go.mod h1:KyV4OO/9/tAxaLSjyjFyOQBcS9bYUdei1hwk3nl0UjI= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= @@ -657,8 +657,8 @@ google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.185.0 h1:ENEKk1k4jW8SmmaT6RE+ZasxmxezCrD5Vw4npvr+pAU= -google.golang.org/api v0.185.0/go.mod h1:HNfvIkJGlgrIlrbYkAm9W9IdkmKZjOTVh33YltygGbg= +google.golang.org/api v0.187.0 h1:Mxs7VATVC2v7CY+7Xwm4ndkX71hpElcvx0D1Ji/p1eo= +google.golang.org/api v0.187.0/go.mod h1:KIHlTc4x7N7gKKuVsdmfBXN13yEEWXWFURWY6SBp2gk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -673,11 +673,11 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 h1:CUiCqkPw1nNrNQzCCG4WA65m0nAmQiwXHpub3dNyruU= -google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be h1:Zz7rLWqp0ApfsR/l7+zSHhY3PMiH2xqgxlfYfAfNpoU= -google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be/go.mod h1:dvdCTIoAGbkWbcIKBniID56/7XHTt6WfxXNMxuziJ+w= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 h1:Di6ANFilr+S60a4S61ZM00vLdw0IrQOSMS2/6mrnOU0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto v0.0.0-20240624140628-dc46fd24d27d h1:PksQg4dV6Sem3/HkBX+Ltq8T0ke0PKIRBNBatoDTVls= +google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 h1:QW9+G6Fir4VcRXVH8x3LilNAb6cxBGLa6+GM4hRwexE= +google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3/go.mod h1:kdrSS/OiLkPrNUpzD4aHgCq2rVuC/YRxok32HXZ4vRE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d h1:k3zyW3BYYR30e8v3x0bTDdE9vpYFjZHK+HcyqkrppWk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -731,14 +731,14 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -k8s.io/api v0.30.1 h1:kCm/6mADMdbAxmIh0LBjS54nQBE+U4KmbCfIkF5CpJY= -k8s.io/api v0.30.1/go.mod h1:ddbN2C0+0DIiPntan/bye3SW3PdwLa11/0yqwvuRrJM= +k8s.io/api v0.30.2 h1:+ZhRj+28QT4UOH+BKznu4CBgPWgkXO7XAvMcMl0qKvI= +k8s.io/api v0.30.2/go.mod h1:ULg5g9JvOev2dG0u2hig4Z7tQ2hHIuS+m8MNZ+X6EmI= k8s.io/apiextensions-apiserver v0.30.1 h1:4fAJZ9985BmpJG6PkoxVRpXv9vmPUOVzl614xarePws= k8s.io/apiextensions-apiserver v0.30.1/go.mod h1:R4GuSrlhgq43oRY9sF2IToFh7PVlF1JjfWdoG3pixk4= -k8s.io/apimachinery v0.30.1 h1:ZQStsEfo4n65yAdlGTfP/uSHMQSoYzU/oeEbkmF7P2U= -k8s.io/apimachinery v0.30.1/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q= -k8s.io/client-go v0.30.1/go.mod h1:wrAqLNs2trwiCH/wxxmT/x3hKVH9PuV0GGW0oDoHVqc= +k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg= +k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/client-go v0.30.2 h1:sBIVJdojUNPDU/jObC+18tXWcTJVcwyqS9diGdWHk50= +k8s.io/client-go v0.30.2/go.mod h1:JglKSWULm9xlJLx4KCkfLLQ7XwtlbflV6uFFSHTMgVs= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= @@ -746,16 +746,16 @@ k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f h1:0LQagt0gDpKqvIkAMPaRGc k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f/go.mod h1:S9tOR0FxgyusSNR+MboCuiDpVWkAifZvaYI1Q2ubgro= k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -kmodules.xyz/client-go v0.30.8 h1:LG4sc94GPYyY2yGBEyCdiww4DZryjZ+Z/AxkHlnD+dk= -kmodules.xyz/client-go v0.30.8/go.mod h1:XL3PDQIXG4s3xNRL2SSxIvi8b2WyMGpn26dFnOBz0j4= +kmodules.xyz/client-go v0.30.9 h1:wiLivFlqVZOitAqLFEa1n53GkbYYOmiR8upjIHPHrYk= +kmodules.xyz/client-go v0.30.9/go.mod h1:XL3PDQIXG4s3xNRL2SSxIvi8b2WyMGpn26dFnOBz0j4= kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs= kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE= kmodules.xyz/go-containerregistry v0.0.12 h1:Tl32QGmSqRVm9PUEb/f3dgDeu9zW5fVzt3qmAFIE37I= kmodules.xyz/go-containerregistry v0.0.12/go.mod h1:KgeNg0hDsgeda+qc0NzWk0iVRdF0+ZIg/oRzGoYh78I= kmodules.xyz/offshoot-api v0.29.4 h1:WQV2BIUIoVKKiqZNmZ4gAy367jEdwBhEl3dFCLZM1qA= kmodules.xyz/offshoot-api v0.29.4/go.mod h1:e+NQ0s4gW/YTPWBWEfdISZcmk+tlTq8IjvP5SLdqvko= -kmodules.xyz/resource-metadata v0.18.9 h1:W/39Blg0hCvZYl0rReDIPiOMQuMN//pKVqRjhWAUrKo= -kmodules.xyz/resource-metadata v0.18.9/go.mod h1:qqieeMPdwJIEyAVkGcgh7h9PZbZTLw4KNEkkqEh5EyA= +kmodules.xyz/resource-metadata v0.18.10 h1:B0DAMsJJBuSOGCKzptZvB8AWcbxzDdUm+3CIE7g9ftE= +kmodules.xyz/resource-metadata v0.18.10/go.mod h1:PXyZXif1b1QRpe0Pwr92OeOveptZricB0jLssCjsYTc= kmodules.xyz/resource-metrics v0.30.1 h1:o7mVY8ZwSe5iEILy1eMG4EPZCli7mXZCkgQONjoY9uU= kmodules.xyz/resource-metrics v0.30.1/go.mod h1:UYcQQLN+3o8rNPQJwJa2D9bt5ihJCeo5bCDuQ4O3MPY= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/cloud.google.com/go/auth/CHANGES.md b/vendor/cloud.google.com/go/auth/CHANGES.md index 7ef5fc0d..8a8228f5 100644 --- a/vendor/cloud.google.com/go/auth/CHANGES.md +++ b/vendor/cloud.google.com/go/auth/CHANGES.md @@ -1,5 +1,32 @@ # Changelog +## [0.6.1](https://github.com/googleapis/google-cloud-go/compare/auth/v0.6.0...auth/v0.6.1) (2024-07-01) + + +### Bug Fixes + +* **auth:** Support gRPC API keys ([#10460](https://github.com/googleapis/google-cloud-go/issues/10460)) ([daa6646](https://github.com/googleapis/google-cloud-go/commit/daa6646d2af5d7fb5b30489f4934c7db89868c7c)) +* **auth:** Update http and grpc transports to support token exchange over mTLS ([#10397](https://github.com/googleapis/google-cloud-go/issues/10397)) ([c6dfdcf](https://github.com/googleapis/google-cloud-go/commit/c6dfdcf893c3f971eba15026c12db0a960ae81f2)) + +## [0.6.0](https://github.com/googleapis/google-cloud-go/compare/auth/v0.5.2...auth/v0.6.0) (2024-06-25) + + +### Features + +* **auth:** Add non-blocking token refresh for compute MDS ([#10263](https://github.com/googleapis/google-cloud-go/issues/10263)) ([9ac350d](https://github.com/googleapis/google-cloud-go/commit/9ac350da11a49b8e2174d3fc5b1a5070fec78b4e)) + + +### Bug Fixes + +* **auth:** Return error if envvar detected file returns an error ([#10431](https://github.com/googleapis/google-cloud-go/issues/10431)) ([e52b9a7](https://github.com/googleapis/google-cloud-go/commit/e52b9a7c45468827f5d220ab00965191faeb9d05)) + +## [0.5.2](https://github.com/googleapis/google-cloud-go/compare/auth/v0.5.1...auth/v0.5.2) (2024-06-24) + + +### Bug Fixes + +* **auth:** Fetch initial token when CachedTokenProviderOptions.DisableAutoRefresh is true ([#10415](https://github.com/googleapis/google-cloud-go/issues/10415)) ([3266763](https://github.com/googleapis/google-cloud-go/commit/32667635ca2efad05cd8c087c004ca07d7406913)), refs [#10414](https://github.com/googleapis/google-cloud-go/issues/10414) + ## [0.5.1](https://github.com/googleapis/google-cloud-go/compare/auth/v0.5.0...auth/v0.5.1) (2024-05-31) diff --git a/vendor/cloud.google.com/go/auth/auth.go b/vendor/cloud.google.com/go/auth/auth.go index d579e482..36729b60 100644 --- a/vendor/cloud.google.com/go/auth/auth.go +++ b/vendor/cloud.google.com/go/auth/auth.go @@ -44,6 +44,21 @@ const ( universeDomainDefault = "googleapis.com" ) +// tokenState represents different states for a [Token]. +type tokenState int + +const ( + // fresh indicates that the [Token] is valid. It is not expired or close to + // expired, or the token has no expiry. + fresh tokenState = iota + // stale indicates that the [Token] is close to expired, and should be + // refreshed. The token can be used normally. + stale + // invalid indicates that the [Token] is expired or invalid. The token + // cannot be used for a normal operation. + invalid +) + var ( defaultGrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer" defaultHeader = &jwt.Header{Algorithm: jwt.HeaderAlgRSA256, Type: jwt.HeaderType} @@ -81,13 +96,13 @@ type Token struct { // IsValid reports that a [Token] is non-nil, has a [Token.Value], and has not // expired. A token is considered expired if [Token.Expiry] has passed or will -// pass in the next 10 seconds. +// pass in the next 225 seconds. func (t *Token) IsValid() bool { return t.isValidWithEarlyExpiry(defaultExpiryDelta) } func (t *Token) isValidWithEarlyExpiry(earlyExpiry time.Duration) bool { - if t == nil || t.Value == "" { + if t.isEmpty() { return false } if t.Expiry.IsZero() { @@ -96,6 +111,10 @@ func (t *Token) isValidWithEarlyExpiry(earlyExpiry time.Duration) bool { return !t.Expiry.Round(0).Add(-earlyExpiry).Before(timeNow()) } +func (t *Token) isEmpty() bool { + return t == nil || t.Value == "" +} + // Credentials holds Google credentials, including // [Application Default Credentials](https://developers.google.com/accounts/docs/application-default-credentials). type Credentials struct { @@ -206,11 +225,15 @@ func NewCredentials(opts *CredentialsOptions) *Credentials { // CachedTokenProvider. type CachedTokenProviderOptions struct { // DisableAutoRefresh makes the TokenProvider always return the same token, - // even if it is expired. + // even if it is expired. The default is false. Optional. DisableAutoRefresh bool // ExpireEarly configures the amount of time before a token expires, that it - // should be refreshed. If unset, the default value is 10 seconds. + // should be refreshed. If unset, the default value is 3 minutes and 45 + // seconds. Optional. ExpireEarly time.Duration + // DisableAsyncRefresh configures a synchronous workflow that refreshes + // stale tokens while blocking. The default is false. Optional. + DisableAsyncRefresh bool } func (ctpo *CachedTokenProviderOptions) autoRefresh() bool { @@ -227,34 +250,126 @@ func (ctpo *CachedTokenProviderOptions) expireEarly() time.Duration { return ctpo.ExpireEarly } +func (ctpo *CachedTokenProviderOptions) blockingRefresh() bool { + if ctpo == nil { + return false + } + return ctpo.DisableAsyncRefresh +} + // NewCachedTokenProvider wraps a [TokenProvider] to cache the tokens returned -// by the underlying provider. By default it will refresh tokens ten seconds -// before they expire, but this time can be configured with the optional -// options. +// by the underlying provider. By default it will refresh tokens asynchronously +// (non-blocking mode) within a window that starts 3 minutes and 45 seconds +// before they expire. The asynchronous (non-blocking) refresh can be changed to +// a synchronous (blocking) refresh using the +// CachedTokenProviderOptions.DisableAsyncRefresh option. The time-before-expiry +// duration can be configured using the CachedTokenProviderOptions.ExpireEarly +// option. func NewCachedTokenProvider(tp TokenProvider, opts *CachedTokenProviderOptions) TokenProvider { if ctp, ok := tp.(*cachedTokenProvider); ok { return ctp } return &cachedTokenProvider{ - tp: tp, - autoRefresh: opts.autoRefresh(), - expireEarly: opts.expireEarly(), + tp: tp, + autoRefresh: opts.autoRefresh(), + expireEarly: opts.expireEarly(), + blockingRefresh: opts.blockingRefresh(), } } type cachedTokenProvider struct { - tp TokenProvider - autoRefresh bool - expireEarly time.Duration + tp TokenProvider + autoRefresh bool + expireEarly time.Duration + blockingRefresh bool mu sync.Mutex cachedToken *Token + // isRefreshRunning ensures that the non-blocking refresh will only be + // attempted once, even if multiple callers enter the Token method. + isRefreshRunning bool + // isRefreshErr ensures that the non-blocking refresh will only be attempted + // once per refresh window if an error is encountered. + isRefreshErr bool } func (c *cachedTokenProvider) Token(ctx context.Context) (*Token, error) { + if c.blockingRefresh { + return c.tokenBlocking(ctx) + } + return c.tokenNonBlocking(ctx) +} + +func (c *cachedTokenProvider) tokenNonBlocking(ctx context.Context) (*Token, error) { + switch c.tokenState() { + case fresh: + c.mu.Lock() + defer c.mu.Unlock() + return c.cachedToken, nil + case stale: + c.tokenAsync(ctx) + // Return the stale token immediately to not block customer requests to Cloud services. + c.mu.Lock() + defer c.mu.Unlock() + return c.cachedToken, nil + default: // invalid + return c.tokenBlocking(ctx) + } +} + +// tokenState reports the token's validity. +func (c *cachedTokenProvider) tokenState() tokenState { + c.mu.Lock() + defer c.mu.Unlock() + t := c.cachedToken + if t == nil || t.Value == "" { + return invalid + } else if t.Expiry.IsZero() { + return fresh + } else if timeNow().After(t.Expiry.Round(0)) { + return invalid + } else if timeNow().After(t.Expiry.Round(0).Add(-c.expireEarly)) { + return stale + } + return fresh +} + +// tokenAsync uses a bool to ensure that only one non-blocking token refresh +// happens at a time, even if multiple callers have entered this function +// concurrently. This avoids creating an arbitrary number of concurrent +// goroutines. Retries should be attempted and managed within the Token method. +// If the refresh attempt fails, no further attempts are made until the refresh +// window expires and the token enters the invalid state, at which point the +// blocking call to Token should likely return the same error on the main goroutine. +func (c *cachedTokenProvider) tokenAsync(ctx context.Context) { + fn := func() { + c.mu.Lock() + c.isRefreshRunning = true + c.mu.Unlock() + t, err := c.tp.Token(ctx) + c.mu.Lock() + defer c.mu.Unlock() + c.isRefreshRunning = false + if err != nil { + // Discard errors from the non-blocking refresh, but prevent further + // attempts. + c.isRefreshErr = true + return + } + c.cachedToken = t + } + c.mu.Lock() + defer c.mu.Unlock() + if !c.isRefreshRunning && !c.isRefreshErr { + go fn() + } +} + +func (c *cachedTokenProvider) tokenBlocking(ctx context.Context) (*Token, error) { c.mu.Lock() defer c.mu.Unlock() - if c.cachedToken.IsValid() || !c.autoRefresh { + c.isRefreshErr = false + if c.cachedToken.IsValid() || (!c.autoRefresh && !c.cachedToken.isEmpty()) { return c.cachedToken, nil } t, err := c.tp.Token(ctx) diff --git a/vendor/cloud.google.com/go/auth/credentials/compute.go b/vendor/cloud.google.com/go/auth/credentials/compute.go index f3ec8882..6f70fa35 100644 --- a/vendor/cloud.google.com/go/auth/credentials/compute.go +++ b/vendor/cloud.google.com/go/auth/credentials/compute.go @@ -37,9 +37,10 @@ var ( // computeTokenProvider creates a [cloud.google.com/go/auth.TokenProvider] that // uses the metadata service to retrieve tokens. -func computeTokenProvider(earlyExpiry time.Duration, scope ...string) auth.TokenProvider { - return auth.NewCachedTokenProvider(computeProvider{scopes: scope}, &auth.CachedTokenProviderOptions{ - ExpireEarly: earlyExpiry, +func computeTokenProvider(opts *DetectOptions) auth.TokenProvider { + return auth.NewCachedTokenProvider(computeProvider{scopes: opts.Scopes}, &auth.CachedTokenProviderOptions{ + ExpireEarly: opts.EarlyTokenRefresh, + DisableAsyncRefresh: opts.DisableAsyncRefresh, }) } diff --git a/vendor/cloud.google.com/go/auth/credentials/detect.go b/vendor/cloud.google.com/go/auth/credentials/detect.go index cb3f44f5..cfa0c88f 100644 --- a/vendor/cloud.google.com/go/auth/credentials/detect.go +++ b/vendor/cloud.google.com/go/auth/credentials/detect.go @@ -37,6 +37,9 @@ const ( googleAuthURL = "https://accounts.google.com/o/oauth2/auth" googleTokenURL = "https://oauth2.googleapis.com/token" + // GoogleMTLSTokenURL is Google's default OAuth2.0 mTLS endpoint. + GoogleMTLSTokenURL = "https://oauth2.mtls.googleapis.com/token" + // Help on default credentials adcSetupURL = "https://cloud.google.com/docs/authentication/external/set-up-adc" ) @@ -80,9 +83,11 @@ func DetectDefault(opts *DetectOptions) (*auth.Credentials, error) { return readCredentialsFile(opts.CredentialsFile, opts) } if filename := os.Getenv(credsfile.GoogleAppCredsEnvVar); filename != "" { - if creds, err := readCredentialsFile(filename, opts); err == nil { - return creds, err + creds, err := readCredentialsFile(filename, opts) + if err != nil { + return nil, err } + return creds, nil } fileName := credsfile.GetWellKnownFileName() @@ -92,7 +97,7 @@ func DetectDefault(opts *DetectOptions) (*auth.Credentials, error) { if OnGCE() { return auth.NewCredentials(&auth.CredentialsOptions{ - TokenProvider: computeTokenProvider(opts.EarlyTokenRefresh, opts.Scopes...), + TokenProvider: computeTokenProvider(opts), ProjectIDProvider: auth.CredentialsPropertyFunc(func(context.Context) (string, error) { return metadata.ProjectID() }), @@ -116,8 +121,13 @@ type DetectOptions struct { // Optional. Subject string // EarlyTokenRefresh configures how early before a token expires that it - // should be refreshed. + // should be refreshed. Once the token’s time until expiration has entered + // this refresh window the token is considered valid but stale. If unset, + // the default value is 3 minutes and 45 seconds. Optional. EarlyTokenRefresh time.Duration + // DisableAsyncRefresh configures a synchronous workflow that refreshes + // stale tokens while blocking. The default is false. Optional. + DisableAsyncRefresh bool // AuthHandlerOptions configures an authorization handler and other options // for 3LO flows. It is required, and only used, for client credential // flows. diff --git a/vendor/cloud.google.com/go/auth/httptransport/httptransport.go b/vendor/cloud.google.com/go/auth/httptransport/httptransport.go index ef09c1b7..969c8d4d 100644 --- a/vendor/cloud.google.com/go/auth/httptransport/httptransport.go +++ b/vendor/cloud.google.com/go/auth/httptransport/httptransport.go @@ -116,6 +116,13 @@ func (o *Options) resolveDetectOptions() *detect.DetectOptions { if len(do.Scopes) == 0 && do.Audience == "" && io != nil { do.Audience = o.InternalOptions.DefaultAudience } + if o.ClientCertProvider != nil { + tlsConfig := &tls.Config{ + GetClientCertificate: o.ClientCertProvider, + } + do.Client = transport.DefaultHTTPClientWithTLS(tlsConfig) + do.TokenURL = detect.GoogleMTLSTokenURL + } return do } @@ -195,6 +202,8 @@ func NewClient(opts *Options) (*http.Client, error) { if baseRoundTripper == nil { baseRoundTripper = defaultBaseTransport(clientCertProvider, dialTLSContext) } + // Ensure the token exchange transport uses the same ClientCertProvider as the API transport. + opts.ClientCertProvider = clientCertProvider trans, err := newTransport(baseRoundTripper, opts) if err != nil { return nil, err diff --git a/vendor/cloud.google.com/go/auth/internal/transport/cba.go b/vendor/cloud.google.com/go/auth/internal/transport/cba.go index 6ef88311..d94e0af0 100644 --- a/vendor/cloud.google.com/go/auth/internal/transport/cba.go +++ b/vendor/cloud.google.com/go/auth/internal/transport/cba.go @@ -176,7 +176,7 @@ func GetHTTPTransportConfig(opts *Options) (cert.Provider, func(context.Context, } func getTransportConfig(opts *Options) (*transportConfig, error) { - clientCertSource, err := getClientCertificateSource(opts) + clientCertSource, err := GetClientCertificateProvider(opts) if err != nil { return nil, err } @@ -210,13 +210,13 @@ func getTransportConfig(opts *Options) (*transportConfig, error) { }, nil } -// getClientCertificateSource returns a default client certificate source, if +// GetClientCertificateProvider returns a default client certificate source, if // not provided by the user. // // A nil default source can be returned if the source does not exist. Any exceptions // encountered while initializing the default source will be reported as client // error (ex. corrupt metadata file). -func getClientCertificateSource(opts *Options) (cert.Provider, error) { +func GetClientCertificateProvider(opts *Options) (cert.Provider, error) { if !isClientCertificateEnabled(opts) { return nil, nil } else if opts.ClientCertProvider != nil { diff --git a/vendor/cloud.google.com/go/auth/internal/transport/transport.go b/vendor/cloud.google.com/go/auth/internal/transport/transport.go index b76386d3..2e2451c5 100644 --- a/vendor/cloud.google.com/go/auth/internal/transport/transport.go +++ b/vendor/cloud.google.com/go/auth/internal/transport/transport.go @@ -17,7 +17,11 @@ package transport import ( + "crypto/tls" "fmt" + "net" + "net/http" + "time" "cloud.google.com/go/auth/credentials" ) @@ -74,3 +78,26 @@ func ValidateUniverseDomain(clientUniverseDomain, credentialsUniverseDomain stri } return nil } + +// DefaultHTTPClientWithTLS constructs an HTTPClient using the provided tlsConfig, to support mTLS. +func DefaultHTTPClientWithTLS(tlsConfig *tls.Config) *http.Client { + trans := baseTransport() + trans.TLSClientConfig = tlsConfig + return &http.Client{Transport: trans} +} + +func baseTransport() *http.Transport { + return &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + DualStack: true, + }).DialContext, + MaxIdleConns: 100, + MaxIdleConnsPerHost: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + } +} diff --git a/vendor/cloud.google.com/go/auth/threelegged.go b/vendor/cloud.google.com/go/auth/threelegged.go index 1b8d83c4..1ccdeff8 100644 --- a/vendor/cloud.google.com/go/auth/threelegged.go +++ b/vendor/cloud.google.com/go/auth/threelegged.go @@ -62,7 +62,8 @@ type Options3LO struct { // Optional. Client *http.Client // EarlyTokenExpiry is the time before the token expires that it should be - // refreshed. If not set the default value is 10 seconds. Optional. + // refreshed. If not set the default value is 3 minutes and 45 seconds. + // Optional. EarlyTokenExpiry time.Duration // AuthHandlerOpts provides a set of options for doing a diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 5eb8c077..be88d0a0 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -7086,6 +7086,9 @@ var awsPartition = partition{ endpointKey{ Region: "ca-central-1", }: endpoint{}, + endpointKey{ + Region: "ca-west-1", + }: endpoint{}, endpointKey{ Region: "eu-central-1", }: endpoint{}, @@ -7201,6 +7204,9 @@ var awsPartition = partition{ endpointKey{ Region: "af-south-1", }: endpoint{}, + endpointKey{ + Region: "ap-east-1", + }: endpoint{}, endpointKey{ Region: "ap-northeast-1", }: endpoint{}, @@ -7231,6 +7237,9 @@ var awsPartition = partition{ endpointKey{ Region: "ca-central-1", }: endpoint{}, + endpointKey{ + Region: "ca-west-1", + }: endpoint{}, endpointKey{ Region: "eu-central-1", }: endpoint{}, @@ -14906,6 +14915,18 @@ var awsPartition = partition{ }, }, }, + "globalaccelerator": service{ + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "fips-us-west-2", + }: endpoint{ + Hostname: "globalaccelerator-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, "glue": service{ Endpoints: serviceEndpoints{ endpointKey{ @@ -20944,6 +20965,9 @@ var awsPartition = partition{ }, "meetings-chime": service{ Endpoints: serviceEndpoints{ + endpointKey{ + Region: "af-south-1", + }: endpoint{}, endpointKey{ Region: "ap-northeast-1", }: endpoint{}, @@ -20962,6 +20986,21 @@ var awsPartition = partition{ endpointKey{ Region: "ca-central-1", }: endpoint{}, + endpointKey{ + Region: "ca-central-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "meetings-chime-fips.ca-central-1.amazonaws.com", + }, + endpointKey{ + Region: "ca-central-1-fips", + }: endpoint{ + Hostname: "meetings-chime-fips.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + Deprecated: boxedTrue, + }, endpointKey{ Region: "eu-central-1", }: endpoint{}, @@ -22515,6 +22554,14 @@ var awsPartition = partition{ Region: "ca-central-1", }, }, + endpointKey{ + Region: "ca-west-1", + }: endpoint{ + Hostname: "oidc.ca-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-west-1", + }, + }, endpointKey{ Region: "eu-central-1", }: endpoint{ @@ -30392,6 +30439,9 @@ var awsPartition = partition{ }: endpoint{ Hostname: "sms-voice-fips.ca-central-1.amazonaws.com", }, + endpointKey{ + Region: "ca-west-1", + }: endpoint{}, endpointKey{ Region: "eu-central-1", }: endpoint{}, @@ -36081,6 +36131,21 @@ var awscnPartition = partition{ }: endpoint{}, }, }, + "acm-pca": service{ + Defaults: endpointDefaults{ + defaultKey{}: endpoint{ + Protocols: []string{"https"}, + }, + }, + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "cn-north-1", + }: endpoint{}, + endpointKey{ + Region: "cn-northwest-1", + }: endpoint{}, + }, + }, "airflow": service{ Endpoints: serviceEndpoints{ endpointKey{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 193f4be1..b2b08904 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.54.6" +const SDKVersion = "1.54.15" diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go index dfe8301e..5d51566f 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -65051,7 +65051,30 @@ type ByoipCidr struct { // this time. NetworkBorderGroup *string `locationName:"networkBorderGroup" type:"string"` - // The state of the address pool. + // The state of the address range. + // + // * advertised: The address range is being advertised to the internet by + // Amazon Web Services. + // + // * deprovisioned: The address range is deprovisioned. + // + // * failed-deprovision: The request to deprovision the address range was + // unsuccessful. Ensure that all EIPs from the range have been deallocated + // and try again. + // + // * failed-provision: The request to provision the address range was unsuccessful. + // + // * pending-deprovision: You’ve submitted a request to deprovision an + // address range and it's pending. + // + // * pending-provision: You’ve submitted a request to provision an address + // range and it's pending. + // + // * provisioned: The address range is provisioned and can be advertised. + // The range is not currently advertised. + // + // * provisioned-not-publicly-advertisable: The address range is provisioned + // and cannot be advertised. State *string `locationName:"state" type:"string" enum:"ByoipCidrState"` // Upon success, contains the ID of the address pool. Otherwise, contains an @@ -73326,15 +73349,14 @@ type CreateInstanceConnectEndpointInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // Indicates whether your client's IP address is preserved as the source. The - // value is true or false. + // Indicates whether the client IP address is preserved as the source. The following + // are the possible values. // - // * If true, your client's IP address is used when you connect to a resource. + // * true - Use the client IP address as the source. // - // * If false, the elastic network interface IP address is used when you - // connect to a resource. + // * false - Use the network interface IP address as the source. // - // Default: true + // Default: false PreserveClientIp *bool `type:"boolean"` // One or more security groups to associate with the endpoint. If you don't @@ -81941,7 +81963,12 @@ type CreateVolumeInput struct { // in the Amazon EBS User Guide. MultiAttachEnabled *bool `type:"boolean"` - // The Amazon Resource Name (ARN) of the Outpost. + // The Amazon Resource Name (ARN) of the Outpost on which to create the volume. + // + // If you intend to use a volume with an instance running on an outpost, then + // you must create the volume on the same outpost as the instance. You can't + // use a volume created in an Amazon Web Services Region with an instance on + // an Amazon Web Services outpost, or the other way around. OutpostArn *string `type:"string"` // The size of the volume, in GiBs. You must specify either a snapshot ID or @@ -111423,7 +111450,7 @@ type DescribeVolumesInput struct { // from the end of the items returned by the previous request. NextToken *string `locationName:"nextToken" type:"string"` - // The volume IDs. + // The volume IDs. If not specified, then all volumes are included in the response. VolumeIds []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` } @@ -138008,7 +138035,7 @@ type InstanceRequirements struct { // // The parameter accepts an integer, which Amazon EC2 interprets as a percentage. // - // If you set DesiredCapacityType to vcpu or memory-mib, the price protection + // If you set TargetCapacityUnitType to vcpu or memory-mib, the price protection // threshold is based on the per vCPU or per memory price instead of the per // instance price. // @@ -138500,7 +138527,7 @@ type InstanceRequirementsRequest struct { // // The parameter accepts an integer, which Amazon EC2 interprets as a percentage. // - // If you set DesiredCapacityType to vcpu or memory-mib, the price protection + // If you set TargetCapacityUnitType to vcpu or memory-mib, the price protection // threshold is based on the per vCPU or per memory price instead of the per // instance price. // @@ -150273,10 +150300,10 @@ type ModifyInstanceAttributeInput struct { // a PV instance can make it unreachable. SriovNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` - // Changes the instance's user data to the specified value. If you are using - // an Amazon Web Services SDK or command line tool, base64-encoding is performed - // for you, and you can load the text from a file. Otherwise, you must provide - // base64-encoded text. + // Changes the instance's user data to the specified value. User data must be + // base64-encoded. Depending on the tool or SDK that you're using, the base64-encoding + // might be performed for you. For more information, see Work with instance + // user data (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-add-user-data.html). UserData *BlobAttributeValue `locationName:"userData" type:"structure"` // A new value for the attribute. Use only with the kernel, ramdisk, userData, @@ -173075,11 +173102,10 @@ type RunInstancesInput struct { // To tag a resource after it has been created, see CreateTags (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html). TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` - // The user data script to make available to the instance. For more information, - // see Run commands on your Amazon EC2 instance at launch (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) - // in the Amazon EC2 User Guide. If you are using a command line tool, base64-encoding - // is performed for you, and you can load the text from a file. Otherwise, you - // must provide base64-encoded text. User data is limited to 16 KB. + // The user data to make available to the instance. User data must be base64-encoded. + // Depending on the tool or SDK that you're using, the base64-encoding might + // be performed for you. For more information, see Work with instance user data + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-add-user-data.html). // // UserData is a sensitive parameter and its value will be // replaced with "sensitive" in string returned by RunInstancesInput's @@ -193898,6 +193924,9 @@ func HostRecovery_Values() []string { } const ( + // HostTenancyDefault is a HostTenancy enum value + HostTenancyDefault = "default" + // HostTenancyDedicated is a HostTenancy enum value HostTenancyDedicated = "dedicated" @@ -193908,6 +193937,7 @@ const ( // HostTenancy_Values returns all elements of the HostTenancy enum func HostTenancy_Values() []string { return []string{ + HostTenancyDefault, HostTenancyDedicated, HostTenancyHost, } @@ -196916,6 +196946,51 @@ const ( // InstanceTypeU7in32tb224xlarge is a InstanceType enum value InstanceTypeU7in32tb224xlarge = "u7in-32tb.224xlarge" + + // InstanceTypeU7ib12tb224xlarge is a InstanceType enum value + InstanceTypeU7ib12tb224xlarge = "u7ib-12tb.224xlarge" + + // InstanceTypeC7gnMetal is a InstanceType enum value + InstanceTypeC7gnMetal = "c7gn.metal" + + // InstanceTypeR8gMedium is a InstanceType enum value + InstanceTypeR8gMedium = "r8g.medium" + + // InstanceTypeR8gLarge is a InstanceType enum value + InstanceTypeR8gLarge = "r8g.large" + + // InstanceTypeR8gXlarge is a InstanceType enum value + InstanceTypeR8gXlarge = "r8g.xlarge" + + // InstanceTypeR8g2xlarge is a InstanceType enum value + InstanceTypeR8g2xlarge = "r8g.2xlarge" + + // InstanceTypeR8g4xlarge is a InstanceType enum value + InstanceTypeR8g4xlarge = "r8g.4xlarge" + + // InstanceTypeR8g8xlarge is a InstanceType enum value + InstanceTypeR8g8xlarge = "r8g.8xlarge" + + // InstanceTypeR8g12xlarge is a InstanceType enum value + InstanceTypeR8g12xlarge = "r8g.12xlarge" + + // InstanceTypeR8g16xlarge is a InstanceType enum value + InstanceTypeR8g16xlarge = "r8g.16xlarge" + + // InstanceTypeR8g24xlarge is a InstanceType enum value + InstanceTypeR8g24xlarge = "r8g.24xlarge" + + // InstanceTypeR8g48xlarge is a InstanceType enum value + InstanceTypeR8g48xlarge = "r8g.48xlarge" + + // InstanceTypeR8gMetal24xl is a InstanceType enum value + InstanceTypeR8gMetal24xl = "r8g.metal-24xl" + + // InstanceTypeR8gMetal48xl is a InstanceType enum value + InstanceTypeR8gMetal48xl = "r8g.metal-48xl" + + // InstanceTypeMac2M1ultraMetal is a InstanceType enum value + InstanceTypeMac2M1ultraMetal = "mac2-m1ultra.metal" ) // InstanceType_Values returns all elements of the InstanceType enum @@ -197726,6 +197801,21 @@ func InstanceType_Values() []string { InstanceTypeU7in16tb224xlarge, InstanceTypeU7in24tb224xlarge, InstanceTypeU7in32tb224xlarge, + InstanceTypeU7ib12tb224xlarge, + InstanceTypeC7gnMetal, + InstanceTypeR8gMedium, + InstanceTypeR8gLarge, + InstanceTypeR8gXlarge, + InstanceTypeR8g2xlarge, + InstanceTypeR8g4xlarge, + InstanceTypeR8g8xlarge, + InstanceTypeR8g12xlarge, + InstanceTypeR8g16xlarge, + InstanceTypeR8g24xlarge, + InstanceTypeR8g48xlarge, + InstanceTypeR8gMetal24xl, + InstanceTypeR8gMetal48xl, + InstanceTypeMac2M1ultraMetal, } } diff --git a/vendor/github.com/googleapis/gax-go/v2/.release-please-manifest.json b/vendor/github.com/googleapis/gax-go/v2/.release-please-manifest.json index d51736e7..433693a6 100644 --- a/vendor/github.com/googleapis/gax-go/v2/.release-please-manifest.json +++ b/vendor/github.com/googleapis/gax-go/v2/.release-please-manifest.json @@ -1,3 +1,3 @@ { - "v2": "2.12.4" + "v2": "2.12.5" } diff --git a/vendor/github.com/googleapis/gax-go/v2/CHANGES.md b/vendor/github.com/googleapis/gax-go/v2/CHANGES.md index 7e36eb48..b64522df 100644 --- a/vendor/github.com/googleapis/gax-go/v2/CHANGES.md +++ b/vendor/github.com/googleapis/gax-go/v2/CHANGES.md @@ -1,5 +1,12 @@ # Changelog +## [2.12.5](https://github.com/googleapis/gax-go/compare/v2.12.4...v2.12.5) (2024-06-18) + + +### Bug Fixes + +* **v2/apierror:** fix (*APIError).Error() for unwrapped Status ([#351](https://github.com/googleapis/gax-go/issues/351)) ([22c16e7](https://github.com/googleapis/gax-go/commit/22c16e7bff5402bdc4c25063771cdd01c650b500)), refs [#350](https://github.com/googleapis/gax-go/issues/350) + ## [2.12.4](https://github.com/googleapis/gax-go/compare/v2.12.3...v2.12.4) (2024-05-03) diff --git a/vendor/github.com/googleapis/gax-go/v2/apierror/apierror.go b/vendor/github.com/googleapis/gax-go/v2/apierror/apierror.go index d785a065..7de60773 100644 --- a/vendor/github.com/googleapis/gax-go/v2/apierror/apierror.go +++ b/vendor/github.com/googleapis/gax-go/v2/apierror/apierror.go @@ -206,8 +206,10 @@ func (a *APIError) Error() string { // Truncate the googleapi.Error message because it dumps the Details in // an ugly way. msg = fmt.Sprintf("googleapi: Error %d: %s", a.httpErr.Code, a.httpErr.Message) - } else if a.status != nil { + } else if a.status != nil && a.err != nil { msg = a.err.Error() + } else if a.status != nil { + msg = a.status.Message() } return strings.TrimSpace(fmt.Sprintf("%s\n%s", msg, a.details)) } diff --git a/vendor/github.com/googleapis/gax-go/v2/header.go b/vendor/github.com/googleapis/gax-go/v2/header.go index 3e53729e..f5273985 100644 --- a/vendor/github.com/googleapis/gax-go/v2/header.go +++ b/vendor/github.com/googleapis/gax-go/v2/header.go @@ -163,11 +163,38 @@ func insertMetadata(ctx context.Context, keyvals ...string) metadata.MD { out = metadata.MD(make(map[string][]string)) } headers := callctx.HeadersFromContext(ctx) - for k, v := range headers { - out[k] = append(out[k], v...) + + // x-goog-api-client is a special case that we want to make sure gets merged + // into a single header. + const xGoogHeader = "x-goog-api-client" + var mergedXgoogHeader strings.Builder + + for k, vals := range headers { + if k == xGoogHeader { + // Merge all values for the x-goog-api-client header set on the ctx. + for _, v := range vals { + mergedXgoogHeader.WriteString(v) + mergedXgoogHeader.WriteRune(' ') + } + continue + } + out[k] = append(out[k], vals...) } for i := 0; i < len(keyvals); i = i + 2 { out[keyvals[i]] = append(out[keyvals[i]], keyvals[i+1]) + + if keyvals[i] == xGoogHeader { + // Merge the x-goog-api-client header values set on the ctx with any + // values passed in for it from the client. + mergedXgoogHeader.WriteString(keyvals[i+1]) + mergedXgoogHeader.WriteRune(' ') + } + } + + // Add the x goog header back in, replacing the separate values that were set. + if mergedXgoogHeader.Len() > 0 { + out[xGoogHeader] = []string{mergedXgoogHeader.String()[:mergedXgoogHeader.Len()-1]} } + return out } diff --git a/vendor/github.com/googleapis/gax-go/v2/internal/version.go b/vendor/github.com/googleapis/gax-go/v2/internal/version.go index 3006ad7b..4f780f46 100644 --- a/vendor/github.com/googleapis/gax-go/v2/internal/version.go +++ b/vendor/github.com/googleapis/gax-go/v2/internal/version.go @@ -30,4 +30,4 @@ package internal // Version is the current tagged release of the library. -const Version = "2.12.4" +const Version = "2.12.5" diff --git a/vendor/github.com/hashicorp/go-retryablehttp/.go-version b/vendor/github.com/hashicorp/go-retryablehttp/.go-version deleted file mode 100644 index 6fee2fed..00000000 --- a/vendor/github.com/hashicorp/go-retryablehttp/.go-version +++ /dev/null @@ -1 +0,0 @@ -1.22.2 diff --git a/vendor/github.com/hashicorp/go-retryablehttp/CHANGELOG.md b/vendor/github.com/hashicorp/go-retryablehttp/CHANGELOG.md index 68a627c6..33686e4d 100644 --- a/vendor/github.com/hashicorp/go-retryablehttp/CHANGELOG.md +++ b/vendor/github.com/hashicorp/go-retryablehttp/CHANGELOG.md @@ -1,32 +1,8 @@ -## 0.7.7 (May 30, 2024) - -BUG FIXES: - -- client: avoid potentially leaking URL-embedded basic authentication credentials in logs (#158) - -## 0.7.6 (May 9, 2024) - -ENHANCEMENTS: - -- client: support a `RetryPrepare` function for modifying the request before retrying (#216) -- client: support HTTP-date values for `Retry-After` header value (#138) -- client: avoid reading entire body when the body is a `*bytes.Reader` (#197) - -BUG FIXES: - -- client: fix a broken check for invalid server certificate in go 1.20+ (#210) - -## 0.7.5 (Nov 8, 2023) - -BUG FIXES: - -- client: fixes an issue where the request body is not preserved on temporary redirects or re-established HTTP/2 connections (#207) - ## 0.7.4 (Jun 6, 2023) -BUG FIXES: +BUG FIXES -- client: fixing an issue where the Content-Type header wouldn't be sent with an empty payload when using HTTP/2 (#194) +- client: fixing an issue where the Content-Type header wouldn't be sent with an empty payload when using HTTP/2 [GH-194] ## 0.7.3 (May 15, 2023) diff --git a/vendor/github.com/hashicorp/go-retryablehttp/CODEOWNERS b/vendor/github.com/hashicorp/go-retryablehttp/CODEOWNERS index d6dd78a2..f8389c99 100644 --- a/vendor/github.com/hashicorp/go-retryablehttp/CODEOWNERS +++ b/vendor/github.com/hashicorp/go-retryablehttp/CODEOWNERS @@ -1 +1 @@ -* @hashicorp/go-retryablehttp-maintainers +* @hashicorp/release-engineering \ No newline at end of file diff --git a/vendor/github.com/hashicorp/go-retryablehttp/Makefile b/vendor/github.com/hashicorp/go-retryablehttp/Makefile index 52552419..da17640e 100644 --- a/vendor/github.com/hashicorp/go-retryablehttp/Makefile +++ b/vendor/github.com/hashicorp/go-retryablehttp/Makefile @@ -2,7 +2,7 @@ default: test test: go vet ./... - go test -v -race ./... + go test -race ./... updatedeps: go get -f -t -u ./... diff --git a/vendor/github.com/hashicorp/go-retryablehttp/README.md b/vendor/github.com/hashicorp/go-retryablehttp/README.md index 145a62f2..8943becf 100644 --- a/vendor/github.com/hashicorp/go-retryablehttp/README.md +++ b/vendor/github.com/hashicorp/go-retryablehttp/README.md @@ -59,4 +59,4 @@ standardClient := retryClient.StandardClient() // *http.Client ``` For more usage and examples see the -[pkg.go.dev](https://pkg.go.dev/github.com/hashicorp/go-retryablehttp). +[godoc](http://godoc.org/github.com/hashicorp/go-retryablehttp). diff --git a/vendor/github.com/hashicorp/go-retryablehttp/cert_error_go119.go b/vendor/github.com/hashicorp/go-retryablehttp/cert_error_go119.go deleted file mode 100644 index b2b27e87..00000000 --- a/vendor/github.com/hashicorp/go-retryablehttp/cert_error_go119.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -//go:build !go1.20 -// +build !go1.20 - -package retryablehttp - -import "crypto/x509" - -func isCertError(err error) bool { - _, ok := err.(x509.UnknownAuthorityError) - return ok -} diff --git a/vendor/github.com/hashicorp/go-retryablehttp/cert_error_go120.go b/vendor/github.com/hashicorp/go-retryablehttp/cert_error_go120.go deleted file mode 100644 index a3cd315a..00000000 --- a/vendor/github.com/hashicorp/go-retryablehttp/cert_error_go120.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -//go:build go1.20 -// +build go1.20 - -package retryablehttp - -import "crypto/tls" - -func isCertError(err error) bool { - _, ok := err.(*tls.CertificateVerificationError) - return ok -} diff --git a/vendor/github.com/hashicorp/go-retryablehttp/client.go b/vendor/github.com/hashicorp/go-retryablehttp/client.go index efee53c4..cad96bd9 100644 --- a/vendor/github.com/hashicorp/go-retryablehttp/client.go +++ b/vendor/github.com/hashicorp/go-retryablehttp/client.go @@ -27,8 +27,10 @@ package retryablehttp import ( "bytes" "context" + "crypto/x509" "fmt" "io" + "io/ioutil" "log" "math" "math/rand" @@ -61,10 +63,6 @@ var ( // limit the size we consume to respReadLimit. respReadLimit = int64(4096) - // timeNow sets the function that returns the current time. - // This defaults to time.Now. Changes to this should only be done in tests. - timeNow = time.Now - // A regular expression to match the error returned by net/http when the // configured number of redirects is exhausted. This error isn't typed // specifically so we resort to matching on the error string. @@ -75,11 +73,6 @@ var ( // specifically so we resort to matching on the error string. schemeErrorRe = regexp.MustCompile(`unsupported protocol scheme`) - // A regular expression to match the error returned by net/http when a - // request header or value is invalid. This error isn't typed - // specifically so we resort to matching on the error string. - invalidHeaderErrorRe = regexp.MustCompile(`invalid header`) - // A regular expression to match the error returned by net/http when the // TLS certificate is not trusted. This error isn't typed // specifically so we resort to matching on the error string. @@ -167,20 +160,6 @@ func (r *Request) SetBody(rawBody interface{}) error { } r.body = bodyReader r.ContentLength = contentLength - if bodyReader != nil { - r.GetBody = func() (io.ReadCloser, error) { - body, err := bodyReader() - if err != nil { - return nil, err - } - if rc, ok := body.(io.ReadCloser); ok { - return rc, nil - } - return io.NopCloser(body), nil - } - } else { - r.GetBody = func() (io.ReadCloser, error) { return http.NoBody, nil } - } return nil } @@ -255,19 +234,21 @@ func getBodyReaderAndContentLength(rawBody interface{}) (ReaderFunc, int64, erro // deal with it seeking so want it to match here instead of the // io.ReadSeeker case. case *bytes.Reader: - snapshot := *body + buf, err := ioutil.ReadAll(body) + if err != nil { + return nil, 0, err + } bodyReader = func() (io.Reader, error) { - r := snapshot - return &r, nil + return bytes.NewReader(buf), nil } - contentLength = int64(body.Len()) + contentLength = int64(len(buf)) // Compat case case io.ReadSeeker: raw := body bodyReader = func() (io.Reader, error) { _, err := raw.Seek(0, 0) - return io.NopCloser(raw), err + return ioutil.NopCloser(raw), err } if lr, ok := raw.(LenReader); ok { contentLength = int64(lr.Len()) @@ -275,7 +256,7 @@ func getBodyReaderAndContentLength(rawBody interface{}) (ReaderFunc, int64, erro // Read all in so we can reset case io.Reader: - buf, err := io.ReadAll(body) + buf, err := ioutil.ReadAll(body) if err != nil { return nil, 0, err } @@ -321,19 +302,18 @@ func NewRequest(method, url string, rawBody interface{}) (*Request, error) { // The context controls the entire lifetime of a request and its response: // obtaining a connection, sending the request, and reading the response headers and body. func NewRequestWithContext(ctx context.Context, method, url string, rawBody interface{}) (*Request, error) { - httpReq, err := http.NewRequestWithContext(ctx, method, url, nil) + bodyReader, contentLength, err := getBodyReaderAndContentLength(rawBody) if err != nil { return nil, err } - req := &Request{ - Request: httpReq, - } - if err := req.SetBody(rawBody); err != nil { + httpReq, err := http.NewRequestWithContext(ctx, method, url, nil) + if err != nil { return nil, err } + httpReq.ContentLength = contentLength - return req, nil + return &Request{body: bodyReader, Request: httpReq}, nil } // Logger interface allows to use other loggers than @@ -398,9 +378,6 @@ type Backoff func(min, max time.Duration, attemptNum int, resp *http.Response) t // attempted. If overriding this, be sure to close the body if needed. type ErrorHandler func(resp *http.Response, err error, numTries int) (*http.Response, error) -// PrepareRetry is called before retry operation. It can be used for example to re-sign the request -type PrepareRetry func(req *http.Request) error - // Client is used to make HTTP requests. It adds additional functionality // like automatic retries to tolerate minor outages. type Client struct { @@ -429,9 +406,6 @@ type Client struct { // ErrorHandler specifies the custom error handler to use, if any ErrorHandler ErrorHandler - // PrepareRetry can prepare the request for retry operation, for example re-sign it - PrepareRetry PrepareRetry - loggerInit sync.Once clientInit sync.Once } @@ -505,16 +479,11 @@ func baseRetryPolicy(resp *http.Response, err error) (bool, error) { return false, v } - // Don't retry if the error was due to an invalid header. - if invalidHeaderErrorRe.MatchString(v.Error()) { - return false, v - } - // Don't retry if the error was due to TLS cert verification failure. if notTrustedErrorRe.MatchString(v.Error()) { return false, v } - if isCertError(v.Err) { + if _, ok := v.Err.(x509.UnknownAuthorityError); ok { return false, v } } @@ -551,8 +520,10 @@ func baseRetryPolicy(resp *http.Response, err error) (bool, error) { func DefaultBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration { if resp != nil { if resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode == http.StatusServiceUnavailable { - if sleep, ok := parseRetryAfterHeader(resp.Header["Retry-After"]); ok { - return sleep + if s, ok := resp.Header["Retry-After"]; ok { + if sleep, err := strconv.ParseInt(s[0], 10, 64); err == nil { + return time.Second * time.Duration(sleep) + } } } } @@ -565,41 +536,6 @@ func DefaultBackoff(min, max time.Duration, attemptNum int, resp *http.Response) return sleep } -// parseRetryAfterHeader parses the Retry-After header and returns the -// delay duration according to the spec: https://httpwg.org/specs/rfc7231.html#header.retry-after -// The bool returned will be true if the header was successfully parsed. -// Otherwise, the header was either not present, or was not parseable according to the spec. -// -// Retry-After headers come in two flavors: Seconds or HTTP-Date -// -// Examples: -// * Retry-After: Fri, 31 Dec 1999 23:59:59 GMT -// * Retry-After: 120 -func parseRetryAfterHeader(headers []string) (time.Duration, bool) { - if len(headers) == 0 || headers[0] == "" { - return 0, false - } - header := headers[0] - // Retry-After: 120 - if sleep, err := strconv.ParseInt(header, 10, 64); err == nil { - if sleep < 0 { // a negative sleep doesn't make sense - return 0, false - } - return time.Second * time.Duration(sleep), true - } - - // Retry-After: Fri, 31 Dec 1999 23:59:59 GMT - retryTime, err := time.Parse(time.RFC1123, header) - if err != nil { - return 0, false - } - if until := retryTime.Sub(timeNow()); until > 0 { - return until, true - } - // date is in the past - return 0, true -} - // LinearJitterBackoff provides a callback for Client.Backoff which will // perform linear backoff based on the attempt number and with jitter to // prevent a thundering herd. @@ -627,13 +563,13 @@ func LinearJitterBackoff(min, max time.Duration, attemptNum int, resp *http.Resp } // Seed rand; doing this every time is fine - source := rand.New(rand.NewSource(int64(time.Now().Nanosecond()))) + rand := rand.New(rand.NewSource(int64(time.Now().Nanosecond()))) // Pick a random number that lies somewhere between the min and max and // multiply by the attemptNum. attemptNum starts at zero so we always // increment here. We first get a random percentage, then apply that to the // difference between min and max, and add to min. - jitter := source.Float64() * float64(max-min) + jitter := rand.Float64() * float64(max-min) jitterMin := int64(jitter) + int64(min) return time.Duration(jitterMin * int64(attemptNum)) } @@ -658,19 +594,19 @@ func (c *Client) Do(req *Request) (*http.Response, error) { if logger != nil { switch v := logger.(type) { case LeveledLogger: - v.Debug("performing request", "method", req.Method, "url", redactURL(req.URL)) + v.Debug("performing request", "method", req.Method, "url", req.URL) case Logger: - v.Printf("[DEBUG] %s %s", req.Method, redactURL(req.URL)) + v.Printf("[DEBUG] %s %s", req.Method, req.URL) } } var resp *http.Response var attempt int var shouldRetry bool - var doErr, respErr, checkErr, prepareErr error + var doErr, respErr, checkErr error for i := 0; ; i++ { - doErr, respErr, prepareErr = nil, nil, nil + doErr, respErr = nil, nil attempt++ // Always rewind the request body when non-nil. @@ -683,7 +619,7 @@ func (c *Client) Do(req *Request) (*http.Response, error) { if c, ok := body.(io.ReadCloser); ok { req.Body = c } else { - req.Body = io.NopCloser(body) + req.Body = ioutil.NopCloser(body) } } @@ -715,9 +651,9 @@ func (c *Client) Do(req *Request) (*http.Response, error) { if err != nil { switch v := logger.(type) { case LeveledLogger: - v.Error("request failed", "error", err, "method", req.Method, "url", redactURL(req.URL)) + v.Error("request failed", "error", err, "method", req.Method, "url", req.URL) case Logger: - v.Printf("[ERR] %s %s request failed: %v", req.Method, redactURL(req.URL), err) + v.Printf("[ERR] %s %s request failed: %v", req.Method, req.URL, err) } } else { // Call this here to maintain the behavior of logging all requests, @@ -753,7 +689,7 @@ func (c *Client) Do(req *Request) (*http.Response, error) { wait := c.Backoff(c.RetryWaitMin, c.RetryWaitMax, i, resp) if logger != nil { - desc := fmt.Sprintf("%s %s", req.Method, redactURL(req.URL)) + desc := fmt.Sprintf("%s %s", req.Method, req.URL) if resp != nil { desc = fmt.Sprintf("%s (status: %d)", desc, resp.StatusCode) } @@ -777,26 +713,17 @@ func (c *Client) Do(req *Request) (*http.Response, error) { // without racing against the closeBody call in persistConn.writeLoop. httpreq := *req.Request req.Request = &httpreq - - if c.PrepareRetry != nil { - if err := c.PrepareRetry(req.Request); err != nil { - prepareErr = err - break - } - } } // this is the closest we have to success criteria - if doErr == nil && respErr == nil && checkErr == nil && prepareErr == nil && !shouldRetry { + if doErr == nil && respErr == nil && checkErr == nil && !shouldRetry { return resp, nil } defer c.HTTPClient.CloseIdleConnections() var err error - if prepareErr != nil { - err = prepareErr - } else if checkErr != nil { + if checkErr != nil { err = checkErr } else if respErr != nil { err = respErr @@ -818,17 +745,17 @@ func (c *Client) Do(req *Request) (*http.Response, error) { // communicate why if err == nil { return nil, fmt.Errorf("%s %s giving up after %d attempt(s)", - req.Method, redactURL(req.URL), attempt) + req.Method, req.URL, attempt) } return nil, fmt.Errorf("%s %s giving up after %d attempt(s): %w", - req.Method, redactURL(req.URL), attempt, err) + req.Method, req.URL, attempt, err) } // Try to read the response body so we can reuse this connection. func (c *Client) drainBody(body io.ReadCloser) { defer body.Close() - _, err := io.Copy(io.Discard, io.LimitReader(body, respReadLimit)) + _, err := io.Copy(ioutil.Discard, io.LimitReader(body, respReadLimit)) if err != nil { if c.logger() != nil { switch v := c.logger().(type) { @@ -903,17 +830,3 @@ func (c *Client) StandardClient() *http.Client { Transport: &RoundTripper{Client: c}, } } - -// Taken from url.URL#Redacted() which was introduced in go 1.15. -// We can switch to using it directly if we'll bump the minimum required go version. -func redactURL(u *url.URL) string { - if u == nil { - return "" - } - - ru := *u - if _, has := ru.User.Password(); has { - ru.User = url.UserPassword(ru.User.Username(), "xxxxx") - } - return ru.String() -} diff --git a/vendor/github.com/linode/linodego/account.go b/vendor/github.com/linode/linodego/account.go index 4ff0a478..ed022f47 100644 --- a/vendor/github.com/linode/linodego/account.go +++ b/vendor/github.com/linode/linodego/account.go @@ -60,11 +60,10 @@ type CreditCard struct { // GetAccount gets the contact and billing information related to the Account. func (c *Client) GetAccount(ctx context.Context) (*Account, error) { e := "account" - req := c.R(ctx).SetResult(&Account{}) - r, err := coupleAPIErrors(req.Get(e)) + response, err := doGETRequest[Account](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*Account), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/account_availability.go b/vendor/github.com/linode/linodego/account_availability.go index d0341083..3824f77b 100644 --- a/vendor/github.com/linode/linodego/account_availability.go +++ b/vendor/github.com/linode/linodego/account_availability.go @@ -2,10 +2,6 @@ package linodego import ( "context" - "fmt" - "net/url" - - "github.com/go-resty/resty/v2" ) // AccountAvailability returns the resources availability in a region to an account. @@ -20,46 +16,23 @@ type AccountAvailability struct { Available []string `json:"available"` } -// AccountAvailabilityPagedResponse represents a paginated Account Availability API response -type AccountAvailabilityPagedResponse struct { - *PageOptions - Data []AccountAvailability `json:"data"` -} - -// endpoint gets the endpoint URL for AccountAvailability -func (AccountAvailabilityPagedResponse) endpoint(_ ...any) string { - return "/account/availability" -} - -func (resp *AccountAvailabilityPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(AccountAvailabilityPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*AccountAvailabilityPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListAccountAvailabilities lists all regions and the resource availabilities to the account. func (c *Client) ListAccountAvailabilities(ctx context.Context, opts *ListOptions) ([]AccountAvailability, error) { - response := AccountAvailabilityPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[AccountAvailability](ctx, c, "account/availability", opts) if err != nil { return nil, err } - return response.Data, nil + + return response, nil } // GetAccountAvailability gets the resources availability in a region to the customer. func (c *Client) GetAccountAvailability(ctx context.Context, regionID string) (*AccountAvailability, error) { - req := c.R(ctx).SetResult(&AccountAvailability{}) - regionID = url.PathEscape(regionID) - b := fmt.Sprintf("account/availability/%s", regionID) - r, err := coupleAPIErrors(req.Get(b)) + b := formatAPIPath("account/availability/%s", regionID) + response, err := doGETRequest[AccountAvailability](ctx, c, b) if err != nil { return nil, err } - return r.Result().(*AccountAvailability), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/account_betas.go b/vendor/github.com/linode/linodego/account_betas.go index 0897a4a7..830905a0 100644 --- a/vendor/github.com/linode/linodego/account_betas.go +++ b/vendor/github.com/linode/linodego/account_betas.go @@ -3,11 +3,8 @@ package linodego import ( "context" "encoding/json" - "fmt" - "net/url" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/parseabletime" ) @@ -28,17 +25,6 @@ type AccountBetaProgramCreateOpts struct { ID string `json:"id"` } -// AccountBetasPagedResponse represents a paginated Account Beta Programs API response -type AccountBetasPagedResponse struct { - *PageOptions - Data []AccountBetaProgram `json:"data"` -} - -// endpoint gets the endpoint URL for AccountBetaProgram -func (AccountBetasPagedResponse) endpoint(_ ...any) string { - return "/account/betas" -} - // UnmarshalJSON implements the json.Unmarshaler interface func (cBeta *AccountBetaProgram) UnmarshalJSON(b []byte) error { type Mask AccountBetaProgram @@ -63,52 +49,35 @@ func (cBeta *AccountBetaProgram) UnmarshalJSON(b []byte) error { return nil } -func (resp *AccountBetasPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(AccountBetasPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*AccountBetasPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListAccountBetaPrograms lists all beta programs an account is enrolled in. func (c *Client) ListAccountBetaPrograms(ctx context.Context, opts *ListOptions) ([]AccountBetaProgram, error) { - response := AccountBetasPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[AccountBetaProgram](ctx, c, "/account/betas", opts) if err != nil { return nil, err } - return response.Data, nil + + return response, nil } // GetAccountBetaProgram gets the details of a beta program an account is enrolled in. func (c *Client) GetAccountBetaProgram(ctx context.Context, betaID string) (*AccountBetaProgram, error) { - req := c.R(ctx).SetResult(&AccountBetaProgram{}) - betaID = url.PathEscape(betaID) - b := fmt.Sprintf("/account/betas/%s", betaID) - r, err := coupleAPIErrors(req.Get(b)) + b := formatAPIPath("/account/betas/%s", betaID) + + response, err := doGETRequest[AccountBetaProgram](ctx, c, b) if err != nil { return nil, err } - return r.Result().(*AccountBetaProgram), nil + return response, nil } // JoinBetaProgram enrolls an account into a beta program. func (c *Client) JoinBetaProgram(ctx context.Context, opts AccountBetaProgramCreateOpts) (*AccountBetaProgram, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - e := "account/betas" - req := c.R(ctx).SetResult(&AccountBetaProgram{}).SetBody(string(body)) - r, err := coupleAPIErrors(req.Post(e)) + response, err := doPOSTRequest[AccountBetaProgram](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*AccountBetaProgram), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/account_child.go b/vendor/github.com/linode/linodego/account_child.go index ce45321c..c11a9d3e 100644 --- a/vendor/github.com/linode/linodego/account_child.go +++ b/vendor/github.com/linode/linodego/account_child.go @@ -14,6 +14,7 @@ type ChildAccount = Account type ChildAccountToken = Token // ListChildAccounts lists child accounts under the current account. +// NOTE: Parent/Child related features may not be generally available. func (c *Client) ListChildAccounts(ctx context.Context, opts *ListOptions) ([]ChildAccount, error) { return getPaginatedResults[ChildAccount]( ctx, @@ -24,6 +25,7 @@ func (c *Client) ListChildAccounts(ctx context.Context, opts *ListOptions) ([]Ch } // GetChildAccount gets a single child accounts under the current account. +// NOTE: Parent/Child related features may not be generally available. func (c *Client) GetChildAccount(ctx context.Context, euuid string) (*ChildAccount, error) { return doGETRequest[ChildAccount]( ctx, @@ -35,6 +37,7 @@ func (c *Client) GetChildAccount(ctx context.Context, euuid string) (*ChildAccou // CreateChildAccountToken creates a short-lived token that can be used to // access the Linode API under a child account. // The attributes of this token are not currently configurable. +// NOTE: Parent/Child related features may not be generally available. func (c *Client) CreateChildAccountToken(ctx context.Context, euuid string) (*ChildAccountToken, error) { return doPOSTRequest[ChildAccountToken, any]( ctx, diff --git a/vendor/github.com/linode/linodego/account_events.go b/vendor/github.com/linode/linodego/account_events.go index 7ea8dd8a..678fc57a 100644 --- a/vendor/github.com/linode/linodego/account_events.go +++ b/vendor/github.com/linode/linodego/account_events.go @@ -3,10 +3,8 @@ package linodego import ( "context" "encoding/json" - "fmt" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/duration" "github.com/linode/linodego/internal/parseabletime" ) @@ -270,17 +268,6 @@ type EventEntity struct { URL string `json:"url"` } -// EventsPagedResponse represents a paginated Events API response -type EventsPagedResponse struct { - *PageOptions - Data []Event `json:"data"` -} - -// endpoint gets the endpoint URL for Event -func (EventsPagedResponse) endpoint(_ ...any) string { - return "account/events" -} - // UnmarshalJSON implements the json.Unmarshaler interface func (i *Event) UnmarshalJSON(b []byte) error { type Mask Event @@ -303,51 +290,39 @@ func (i *Event) UnmarshalJSON(b []byte) error { return nil } -func (resp *EventsPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(EventsPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*EventsPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListEvents gets a collection of Event objects representing actions taken // on the Account. The Events returned depend on the token grants and the grants // of the associated user. func (c *Client) ListEvents(ctx context.Context, opts *ListOptions) ([]Event, error) { - response := EventsPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[Event](ctx, c, "account/events", opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } // GetEvent gets the Event with the Event ID func (c *Client) GetEvent(ctx context.Context, eventID int) (*Event, error) { - req := c.R(ctx).SetResult(&Event{}) - e := fmt.Sprintf("account/events/%d", eventID) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("account/events/%d", eventID) + response, err := doGETRequest[Event](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*Event), nil + return response, nil } // MarkEventRead marks a single Event as read. func (c *Client) MarkEventRead(ctx context.Context, event *Event) error { - e := fmt.Sprintf("account/events/%d/read", event.ID) - _, err := coupleAPIErrors(c.R(ctx).Post(e)) + e := formatAPIPath("account/events/%d/read", event.ID) + _, err := doPOSTRequest[Event](ctx, c, e, []any{}) return err } // MarkEventsSeen marks all Events up to and including this Event by ID as seen. func (c *Client) MarkEventsSeen(ctx context.Context, event *Event) error { - e := fmt.Sprintf("account/events/%d/seen", event.ID) - _, err := coupleAPIErrors(c.R(ctx).Post(e)) + e := formatAPIPath("account/events/%d/seen", event.ID) + _, err := doPOSTRequest[Event](ctx, c, e, []any{}) return err } diff --git a/vendor/github.com/linode/linodego/account_invoices.go b/vendor/github.com/linode/linodego/account_invoices.go index d068662f..afc88209 100644 --- a/vendor/github.com/linode/linodego/account_invoices.go +++ b/vendor/github.com/linode/linodego/account_invoices.go @@ -3,10 +3,8 @@ package linodego import ( "context" "encoding/json" - "fmt" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/parseabletime" ) @@ -31,36 +29,14 @@ type InvoiceItem struct { To *time.Time `json:"-"` } -// InvoicesPagedResponse represents a paginated Invoice API response -type InvoicesPagedResponse struct { - *PageOptions - Data []Invoice `json:"data"` -} - -// endpoint gets the endpoint URL for Invoice -func (InvoicesPagedResponse) endpoint(_ ...any) string { - return "account/invoices" -} - -func (resp *InvoicesPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(InvoicesPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*InvoicesPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListInvoices gets a paginated list of Invoices against the Account func (c *Client) ListInvoices(ctx context.Context, opts *ListOptions) ([]Invoice, error) { - response := InvoicesPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[Invoice](ctx, c, "account/invoices", opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } // UnmarshalJSON implements the json.Unmarshaler interface @@ -107,45 +83,21 @@ func (i *InvoiceItem) UnmarshalJSON(b []byte) error { // GetInvoice gets a single Invoice matching the provided ID func (c *Client) GetInvoice(ctx context.Context, invoiceID int) (*Invoice, error) { - req := c.R(ctx).SetResult(&Invoice{}) - e := fmt.Sprintf("account/invoices/%d", invoiceID) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("account/invoices/%d", invoiceID) + response, err := doGETRequest[Invoice](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*Invoice), nil -} - -// InvoiceItemsPagedResponse represents a paginated Invoice Item API response -type InvoiceItemsPagedResponse struct { - *PageOptions - Data []InvoiceItem `json:"data"` -} - -// endpoint gets the endpoint URL for InvoiceItems associated with a specific Invoice -func (InvoiceItemsPagedResponse) endpoint(ids ...any) string { - id := ids[0].(int) - return fmt.Sprintf("account/invoices/%d/items", id) -} - -func (resp *InvoiceItemsPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(InvoiceItemsPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*InvoiceItemsPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil + return response, nil } // ListInvoiceItems gets the invoice items associated with a specific Invoice func (c *Client) ListInvoiceItems(ctx context.Context, invoiceID int, opts *ListOptions) ([]InvoiceItem, error) { - response := InvoiceItemsPagedResponse{} - err := c.listHelper(ctx, &response, opts, invoiceID) + response, err := getPaginatedResults[InvoiceItem](ctx, c, formatAPIPath("account/invoices/%d/items", invoiceID), opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/account_logins.go b/vendor/github.com/linode/linodego/account_logins.go index 9b5f69a9..45f2a5f2 100644 --- a/vendor/github.com/linode/linodego/account_logins.go +++ b/vendor/github.com/linode/linodego/account_logins.go @@ -3,10 +3,8 @@ package linodego import ( "context" "encoding/json" - "fmt" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/parseabletime" ) @@ -19,33 +17,13 @@ type Login struct { Status string `json:"status"` } -type LoginsPagedResponse struct { - *PageOptions - Data []Login `json:"data"` -} - -func (LoginsPagedResponse) endpoint(_ ...any) string { - return "account/logins" -} - -func (resp *LoginsPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(LoginsPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*LoginsPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - func (c *Client) ListLogins(ctx context.Context, opts *ListOptions) ([]Login, error) { - response := LoginsPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[Login](ctx, c, "account/logins", opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } // UnmarshalJSON implements the json.Unmarshaler interface @@ -69,12 +47,12 @@ func (i *Login) UnmarshalJSON(b []byte) error { } func (c *Client) GetLogin(ctx context.Context, loginID int) (*Login, error) { - req := c.R(ctx).SetResult(&Login{}) - e := fmt.Sprintf("account/logins/%d", loginID) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("account/logins/%d", loginID) + + response, err := doGETRequest[Login](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*Login), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/account_notifications.go b/vendor/github.com/linode/linodego/account_notifications.go index df65bd3e..3820f090 100644 --- a/vendor/github.com/linode/linodego/account_notifications.go +++ b/vendor/github.com/linode/linodego/account_notifications.go @@ -5,7 +5,6 @@ import ( "encoding/json" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/parseabletime" ) @@ -57,40 +56,18 @@ const ( NotificationMaintenance NotificationType = "maintenance" ) -// NotificationsPagedResponse represents a paginated Notifications API response -type NotificationsPagedResponse struct { - *PageOptions - Data []Notification `json:"data"` -} - -// endpoint gets the endpoint URL for Notification -func (NotificationsPagedResponse) endpoint(_ ...any) string { - return "account/notifications" -} - -func (resp *NotificationsPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(NotificationsPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*NotificationsPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListNotifications gets a collection of Notification objects representing important, // often time-sensitive items related to the Account. An account cannot interact directly with // Notifications, and a Notification will disappear when the circumstances causing it // have been resolved. For example, if the account has an important Ticket open, a response // to the Ticket will dismiss the Notification. func (c *Client) ListNotifications(ctx context.Context, opts *ListOptions) ([]Notification, error) { - response := NotificationsPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[Notification](ctx, c, "account/notifications", opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } // UnmarshalJSON implements the json.Unmarshaler interface diff --git a/vendor/github.com/linode/linodego/account_oauth_client.go b/vendor/github.com/linode/linodego/account_oauth_client.go index dba898d2..6f2a57a1 100644 --- a/vendor/github.com/linode/linodego/account_oauth_client.go +++ b/vendor/github.com/linode/linodego/account_oauth_client.go @@ -2,11 +2,6 @@ package linodego import ( "context" - "encoding/json" - "fmt" - "net/url" - - "github.com/go-resty/resty/v2" ) // OAuthClientStatus constants start with OAuthClient and include Linode API Instance Status values @@ -85,92 +80,52 @@ func (i OAuthClient) GetUpdateOptions() (o OAuthClientUpdateOptions) { return } -// OAuthClientsPagedResponse represents a paginated OAuthClient API response -type OAuthClientsPagedResponse struct { - *PageOptions - Data []OAuthClient `json:"data"` -} - -// endpoint gets the endpoint URL for OAuthClient -func (OAuthClientsPagedResponse) endpoint(_ ...any) string { - return "account/oauth-clients" -} - -func (resp *OAuthClientsPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(OAuthClientsPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*OAuthClientsPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListOAuthClients lists OAuthClients func (c *Client) ListOAuthClients(ctx context.Context, opts *ListOptions) ([]OAuthClient, error) { - response := OAuthClientsPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[OAuthClient](ctx, c, "account/oauth-clients", opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } // GetOAuthClient gets the OAuthClient with the provided ID func (c *Client) GetOAuthClient(ctx context.Context, clientID string) (*OAuthClient, error) { - req := c.R(ctx).SetResult(&OAuthClient{}) - clientID = url.PathEscape(clientID) - e := fmt.Sprintf("account/oauth-clients/%s", clientID) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("account/oauth-clients/%s", clientID) + response, err := doGETRequest[OAuthClient](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*OAuthClient), nil + return response, nil } // CreateOAuthClient creates an OAuthClient func (c *Client) CreateOAuthClient(ctx context.Context, opts OAuthClientCreateOptions) (*OAuthClient, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - - req := c.R(ctx).SetResult(&OAuthClient{}).SetBody(string(body)) e := "account/oauth-clients" - r, err := coupleAPIErrors(req.Post(e)) + response, err := doPOSTRequest[OAuthClient](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*OAuthClient), nil + return response, nil } // UpdateOAuthClient updates the OAuthClient with the specified id func (c *Client) UpdateOAuthClient(ctx context.Context, clientID string, opts OAuthClientUpdateOptions) (*OAuthClient, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - - req := c.R(ctx).SetResult(&OAuthClient{}).SetBody(string(body)) - - clientID = url.PathEscape(clientID) - - e := fmt.Sprintf("account/oauth-clients/%s", clientID) - r, err := coupleAPIErrors(req.Put(e)) + e := formatAPIPath("account/oauth-clients/%s", clientID) + response, err := doPUTRequest[OAuthClient](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*OAuthClient), nil + return response, nil } // DeleteOAuthClient deletes the OAuthClient with the specified id func (c *Client) DeleteOAuthClient(ctx context.Context, clientID string) error { - clientID = url.PathEscape(clientID) - e := fmt.Sprintf("account/oauth-clients/%s", clientID) - _, err := coupleAPIErrors(c.R(ctx).Delete(e)) + e := formatAPIPath("account/oauth-clients/%s", clientID) + err := doDELETERequest(ctx, c, e) return err } diff --git a/vendor/github.com/linode/linodego/account_payments.go b/vendor/github.com/linode/linodego/account_payments.go index a2fe17b6..452f53f1 100644 --- a/vendor/github.com/linode/linodego/account_payments.go +++ b/vendor/github.com/linode/linodego/account_payments.go @@ -3,10 +3,8 @@ package linodego import ( "context" "encoding/json" - "fmt" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/parseabletime" ) @@ -57,63 +55,34 @@ func (i Payment) GetCreateOptions() (o PaymentCreateOptions) { return } -// PaymentsPagedResponse represents a paginated Payment API response -type PaymentsPagedResponse struct { - *PageOptions - Data []Payment `json:"data"` -} - -// endpoint gets the endpoint URL for Payment -func (PaymentsPagedResponse) endpoint(_ ...any) string { - return "account/payments" -} - -func (resp *PaymentsPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(PaymentsPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*PaymentsPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListPayments lists Payments func (c *Client) ListPayments(ctx context.Context, opts *ListOptions) ([]Payment, error) { - response := PaymentsPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[Payment](ctx, c, "account/payments", opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } // GetPayment gets the payment with the provided ID func (c *Client) GetPayment(ctx context.Context, paymentID int) (*Payment, error) { - req := c.R(ctx).SetResult(&Payment{}) - e := fmt.Sprintf("account/payments/%d", paymentID) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("account/payments/%d", paymentID) + response, err := doGETRequest[Payment](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*Payment), nil + return response, nil } // CreatePayment creates a Payment func (c *Client) CreatePayment(ctx context.Context, opts PaymentCreateOptions) (*Payment, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - - req := c.R(ctx).SetResult(&Payment{}).SetBody(string(body)) e := "accounts/payments" - r, err := coupleAPIErrors(req.Post(e)) + response, err := doPOSTRequest[Payment](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*Payment), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/account_settings.go b/vendor/github.com/linode/linodego/account_settings.go index 9a4b1362..5edef5be 100644 --- a/vendor/github.com/linode/linodego/account_settings.go +++ b/vendor/github.com/linode/linodego/account_settings.go @@ -2,7 +2,6 @@ package linodego import ( "context" - "encoding/json" ) // AccountSettings are the account wide flags or plans that effect new resources @@ -38,29 +37,24 @@ type AccountSettingsUpdateOptions struct { // GetAccountSettings gets the account wide flags or plans that effect new resources func (c *Client) GetAccountSettings(ctx context.Context) (*AccountSettings, error) { - req := c.R(ctx).SetResult(&AccountSettings{}) e := "account/settings" - r, err := coupleAPIErrors(req.Get(e)) + + response, err := doGETRequest[AccountSettings](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*AccountSettings), nil + return response, nil } // UpdateAccountSettings updates the settings associated with the account func (c *Client) UpdateAccountSettings(ctx context.Context, opts AccountSettingsUpdateOptions) (*AccountSettings, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - - req := c.R(ctx).SetResult(&AccountSettings{}).SetBody(string(body)) e := "account/settings" - r, err := coupleAPIErrors(req.Put(e)) + + response, err := doPUTRequest[AccountSettings](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*AccountSettings), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/account_transfer.go b/vendor/github.com/linode/linodego/account_transfer.go index 11557302..1420f278 100644 --- a/vendor/github.com/linode/linodego/account_transfer.go +++ b/vendor/github.com/linode/linodego/account_transfer.go @@ -22,12 +22,12 @@ type AccountTransferRegion struct { // GetAccountTransfer gets current Account's network utilization for the current month. func (c *Client) GetAccountTransfer(ctx context.Context) (*AccountTransfer, error) { - req := c.R(ctx).SetResult(&AccountTransfer{}) e := "account/transfer" - r, err := coupleAPIErrors(req.Get(e)) + + response, err := doGETRequest[AccountTransfer](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*AccountTransfer), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/account_user_grants.go b/vendor/github.com/linode/linodego/account_user_grants.go index 221fb5f7..f0ca1dc7 100644 --- a/vendor/github.com/linode/linodego/account_user_grants.go +++ b/vendor/github.com/linode/linodego/account_user_grants.go @@ -2,9 +2,6 @@ package linodego import ( "context" - "encoding/json" - "fmt" - "net/url" ) type GrantPermissionLevel string @@ -69,30 +66,21 @@ type UserGrantsUpdateOptions struct { } func (c *Client) GetUserGrants(ctx context.Context, username string) (*UserGrants, error) { - username = url.PathEscape(username) - e := fmt.Sprintf("account/users/%s/grants", username) - req := c.R(ctx).SetResult(&UserGrants{}) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("account/users/%s/grants", username) + response, err := doGETRequest[UserGrants](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*UserGrants), nil + return response, nil } func (c *Client) UpdateUserGrants(ctx context.Context, username string, opts UserGrantsUpdateOptions) (*UserGrants, error) { - body, err := json.Marshal(opts) + e := formatAPIPath("account/users/%s/grants", username) + response, err := doPUTRequest[UserGrants](ctx, c, e, opts) if err != nil { return nil, err } - username = url.PathEscape(username) - e := fmt.Sprintf("account/users/%s/grants", username) - req := c.R(ctx).SetResult(&UserGrants{}).SetBody(string(body)) - r, err := coupleAPIErrors(req.Put(e)) - if err != nil { - return nil, err - } - - return r.Result().(*UserGrants), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/account_users.go b/vendor/github.com/linode/linodego/account_users.go index 5906c462..e01e6dde 100644 --- a/vendor/github.com/linode/linodego/account_users.go +++ b/vendor/github.com/linode/linodego/account_users.go @@ -3,11 +3,8 @@ package linodego import ( "context" "encoding/json" - "fmt" - "net/url" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/parseabletime" ) @@ -82,91 +79,53 @@ func (i User) GetUpdateOptions() (o UserUpdateOptions) { return } -// UsersPagedResponse represents a paginated User API response -type UsersPagedResponse struct { - *PageOptions - Data []User `json:"data"` -} - -// endpoint gets the endpoint URL for User -func (UsersPagedResponse) endpoint(_ ...any) string { - return "account/users" -} - -func (resp *UsersPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(UsersPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*UsersPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListUsers lists Users on the account func (c *Client) ListUsers(ctx context.Context, opts *ListOptions) ([]User, error) { - response := UsersPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[User](ctx, c, "account/users", opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } // GetUser gets the user with the provided ID func (c *Client) GetUser(ctx context.Context, userID string) (*User, error) { - userID = url.PathEscape(userID) - e := fmt.Sprintf("account/users/%s", userID) - req := c.R(ctx).SetResult(&User{}) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("account/users/%s", userID) + response, err := doGETRequest[User](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*User), nil + return response, nil } // CreateUser creates a User. The email address must be confirmed before the // User account can be accessed. func (c *Client) CreateUser(ctx context.Context, opts UserCreateOptions) (*User, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - e := "account/users" - req := c.R(ctx).SetResult(&User{}).SetBody(string(body)) - r, err := coupleAPIErrors(req.Post(e)) + response, err := doPOSTRequest[User](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*User), nil + return response, nil } // UpdateUser updates the User with the specified id func (c *Client) UpdateUser(ctx context.Context, userID string, opts UserUpdateOptions) (*User, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - - userID = url.PathEscape(userID) - e := fmt.Sprintf("account/users/%s", userID) - req := c.R(ctx).SetResult(&User{}).SetBody(string(body)) - r, err := coupleAPIErrors(req.Put(e)) + e := formatAPIPath("account/users/%s", userID) + response, err := doPUTRequest[User](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*User), nil + return response, nil } // DeleteUser deletes the User with the specified id func (c *Client) DeleteUser(ctx context.Context, userID string) error { - userID = url.PathEscape(userID) - e := fmt.Sprintf("account/users/%s", userID) - _, err := coupleAPIErrors(c.R(ctx).Delete(e)) + e := formatAPIPath("account/users/%s", userID) + err := doDELETERequest(ctx, c, e) return err } diff --git a/vendor/github.com/linode/linodego/betas.go b/vendor/github.com/linode/linodego/betas.go index 9cd84ad5..8f90220d 100644 --- a/vendor/github.com/linode/linodego/betas.go +++ b/vendor/github.com/linode/linodego/betas.go @@ -3,11 +3,8 @@ package linodego import ( "context" "encoding/json" - "fmt" - "net/url" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/parseabletime" ) @@ -32,17 +29,6 @@ type BetaProgram struct { MoreInfo string `json:"more_info"` } -// BetasPagedResponse represents a paginated Beta Programs API response -type BetasPagedResponse struct { - *PageOptions - Data []BetaProgram `json:"data"` -} - -// endpoint gets the endpoint URL for BetaProgram -func (BetasPagedResponse) endpoint(_ ...any) string { - return "/betas" -} - // UnmarshalJSON implements the json.Unmarshaler interface func (beta *BetaProgram) UnmarshalJSON(b []byte) error { type Mask BetaProgram @@ -65,35 +51,23 @@ func (beta *BetaProgram) UnmarshalJSON(b []byte) error { return nil } -func (resp *BetasPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(BetasPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*BetasPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListBetaPrograms lists active beta programs func (c *Client) ListBetaPrograms(ctx context.Context, opts *ListOptions) ([]BetaProgram, error) { - response := BetasPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[BetaProgram](ctx, c, "/betas", opts) if err != nil { return nil, err } - return response.Data, nil + + return response, nil } // GetBetaProgram gets the beta program's detail with the ID func (c *Client) GetBetaProgram(ctx context.Context, betaID string) (*BetaProgram, error) { - req := c.R(ctx).SetResult(&BetaProgram{}) - betaID = url.PathEscape(betaID) - b := fmt.Sprintf("betas/%s", betaID) - r, err := coupleAPIErrors(req.Get(b)) + e := formatAPIPath("betas/%s", betaID) + response, err := doGETRequest[BetaProgram](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*BetaProgram), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/databases.go b/vendor/github.com/linode/linodego/databases.go index 50d752d5..c665da77 100644 --- a/vendor/github.com/linode/linodego/databases.go +++ b/vendor/github.com/linode/linodego/databases.go @@ -3,11 +3,8 @@ package linodego import ( "context" "encoding/json" - "fmt" - "net/url" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/parseabletime" ) @@ -53,63 +50,6 @@ const ( DatabaseStatusBackingUp DatabaseStatus = "backing_up" ) -type DatabasesPagedResponse struct { - *PageOptions - Data []Database `json:"data"` -} - -func (DatabasesPagedResponse) endpoint(_ ...any) string { - return "databases/instances" -} - -func (resp *DatabasesPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(DatabasesPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*DatabasesPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - -type DatabaseEnginesPagedResponse struct { - *PageOptions - Data []DatabaseEngine `json:"data"` -} - -func (DatabaseEnginesPagedResponse) endpoint(_ ...any) string { - return "databases/engines" -} - -func (resp *DatabaseEnginesPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(DatabaseEnginesPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*DatabaseEnginesPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - -type DatabaseTypesPagedResponse struct { - *PageOptions - Data []DatabaseType `json:"data"` -} - -func (DatabaseTypesPagedResponse) endpoint(_ ...any) string { - return "databases/types" -} - -func (resp *DatabaseTypesPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(DatabaseTypesPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*DatabaseTypesPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // A Database is a instance of Linode Managed Databases type Database struct { ID int `json:"id"` @@ -202,100 +142,52 @@ func (d *Database) UnmarshalJSON(b []byte) error { // ListDatabases lists all Database instances in Linode Managed Databases for the account func (c *Client) ListDatabases(ctx context.Context, opts *ListOptions) ([]Database, error) { - response := DatabasesPagedResponse{} - - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[Database](ctx, c, "databases/instances", opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } // ListDatabaseEngines lists all Database Engines. This endpoint is cached by default. func (c *Client) ListDatabaseEngines(ctx context.Context, opts *ListOptions) ([]DatabaseEngine, error) { - response := DatabaseEnginesPagedResponse{} - - endpoint, err := generateListCacheURL(response.endpoint(), opts) - if err != nil { - return nil, err - } - - if result := c.getCachedResponse(endpoint); result != nil { - return result.([]DatabaseEngine), nil - } - - err = c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[DatabaseEngine](ctx, c, "databases/engines", opts) if err != nil { return nil, err } - c.addCachedResponse(endpoint, response.Data, &cacheExpiryTime) - - return response.Data, nil + return response, nil } // GetDatabaseEngine returns a specific Database Engine. This endpoint is cached by default. func (c *Client) GetDatabaseEngine(ctx context.Context, _ *ListOptions, engineID string) (*DatabaseEngine, error) { - engineID = url.PathEscape(engineID) - e := fmt.Sprintf("databases/engines/%s", engineID) - - if result := c.getCachedResponse(e); result != nil { - result := result.(DatabaseEngine) - return &result, nil - } - - req := c.R(ctx).SetResult(&DatabaseEngine{}) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("databases/engines/%s", engineID) + response, err := doGETRequest[DatabaseEngine](ctx, c, e) if err != nil { return nil, err } - c.addCachedResponse(e, r.Result(), &cacheExpiryTime) - - return r.Result().(*DatabaseEngine), nil + return response, nil } // ListDatabaseTypes lists all Types of Database provided in Linode Managed Databases. This endpoint is cached by default. func (c *Client) ListDatabaseTypes(ctx context.Context, opts *ListOptions) ([]DatabaseType, error) { - response := DatabaseTypesPagedResponse{} - - endpoint, err := generateListCacheURL(response.endpoint(), opts) - if err != nil { - return nil, err - } - - if result := c.getCachedResponse(endpoint); result != nil { - return result.([]DatabaseType), nil - } - - err = c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[DatabaseType](ctx, c, "databases/types", opts) if err != nil { return nil, err } - c.addCachedResponse(endpoint, response.Data, &cacheExpiryTime) - - return response.Data, nil + return response, nil } // GetDatabaseType returns a specific Database Type. This endpoint is cached by default. func (c *Client) GetDatabaseType(ctx context.Context, _ *ListOptions, typeID string) (*DatabaseType, error) { - typeID = url.PathEscape(typeID) - e := fmt.Sprintf("databases/types/%s", typeID) - - if result := c.getCachedResponse(e); result != nil { - result := result.(DatabaseType) - return &result, nil - } - - req := c.R(ctx).SetResult(&DatabaseType{}) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("databases/types/%s", typeID) + response, err := doGETRequest[DatabaseType](ctx, c, e) if err != nil { return nil, err } - c.addCachedResponse(e, r.Result(), &cacheExpiryTime) - - return r.Result().(*DatabaseType), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/domain_records.go b/vendor/github.com/linode/linodego/domain_records.go index fcb664d8..11e246d2 100644 --- a/vendor/github.com/linode/linodego/domain_records.go +++ b/vendor/github.com/linode/linodego/domain_records.go @@ -2,10 +2,6 @@ package linodego import ( "context" - "encoding/json" - "fmt" - - "github.com/go-resty/resty/v2" ) // DomainRecord represents a DomainRecord object @@ -83,86 +79,52 @@ func (d DomainRecord) GetUpdateOptions() (du DomainRecordUpdateOptions) { return } -// DomainRecordsPagedResponse represents a paginated DomainRecord API response -type DomainRecordsPagedResponse struct { - *PageOptions - Data []DomainRecord `json:"data"` -} - -// endpoint gets the endpoint URL for InstanceConfig -func (DomainRecordsPagedResponse) endpoint(ids ...any) string { - id, _ := ids[0].(int) - return fmt.Sprintf("domains/%d/records", id) -} - -func (resp *DomainRecordsPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(DomainRecordsPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*DomainRecordsPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListDomainRecords lists DomainRecords func (c *Client) ListDomainRecords(ctx context.Context, domainID int, opts *ListOptions) ([]DomainRecord, error) { - response := DomainRecordsPagedResponse{} - err := c.listHelper(ctx, &response, opts, domainID) + response, err := getPaginatedResults[DomainRecord](ctx, c, formatAPIPath("domains/%d/records", domainID), opts) if err != nil { return nil, err } - return response.Data, nil + + return response, nil } // GetDomainRecord gets the domainrecord with the provided ID func (c *Client) GetDomainRecord(ctx context.Context, domainID int, recordID int) (*DomainRecord, error) { - req := c.R(ctx).SetResult(&DomainRecord{}) - e := fmt.Sprintf("domains/%d/records/%d", domainID, recordID) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("domains/%d/records/%d", domainID, recordID) + response, err := doGETRequest[DomainRecord](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*DomainRecord), nil + + return response, nil } // CreateDomainRecord creates a DomainRecord func (c *Client) CreateDomainRecord(ctx context.Context, domainID int, opts DomainRecordCreateOptions) (*DomainRecord, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - - e := fmt.Sprintf("domains/%d/records", domainID) - req := c.R(ctx).SetResult(&DomainRecord{}).SetBody(string(body)) - r, err := coupleAPIErrors(req.Post(e)) + e := formatAPIPath("domains/%d/records", domainID) + response, err := doPOSTRequest[DomainRecord](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*DomainRecord), nil + return response, nil } // UpdateDomainRecord updates the DomainRecord with the specified id func (c *Client) UpdateDomainRecord(ctx context.Context, domainID int, recordID int, opts DomainRecordUpdateOptions) (*DomainRecord, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - - e := fmt.Sprintf("domains/%d/records/%d", domainID, recordID) - req := c.R(ctx).SetResult(&DomainRecord{}).SetBody(string(body)) - r, err := coupleAPIErrors(req.Put(e)) + e := formatAPIPath("domains/%d/records/%d", domainID, recordID) + response, err := doPUTRequest[DomainRecord](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*DomainRecord), nil + return response, nil } // DeleteDomainRecord deletes the DomainRecord with the specified id func (c *Client) DeleteDomainRecord(ctx context.Context, domainID int, recordID int) error { - e := fmt.Sprintf("domains/%d/records/%d", domainID, recordID) - _, err := coupleAPIErrors(c.R(ctx).Delete(e)) + e := formatAPIPath("domains/%d/records/%d", domainID, recordID) + err := doDELETERequest(ctx, c, e) return err } diff --git a/vendor/github.com/linode/linodego/domains.go b/vendor/github.com/linode/linodego/domains.go index eff796fa..0bc05bdd 100644 --- a/vendor/github.com/linode/linodego/domains.go +++ b/vendor/github.com/linode/linodego/domains.go @@ -2,10 +2,6 @@ package linodego import ( "context" - "encoding/json" - "fmt" - - "github.com/go-resty/resty/v2" ) // Domain represents a Domain object @@ -188,99 +184,63 @@ func (d Domain) GetUpdateOptions() (du DomainUpdateOptions) { return } -// DomainsPagedResponse represents a paginated Domain API response -type DomainsPagedResponse struct { - *PageOptions - Data []Domain `json:"data"` -} - -// endpoint gets the endpoint URL for Domain -func (DomainsPagedResponse) endpoint(_ ...any) string { - return "domains" -} - -func (resp *DomainsPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(DomainsPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*DomainsPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListDomains lists Domains func (c *Client) ListDomains(ctx context.Context, opts *ListOptions) ([]Domain, error) { - response := DomainsPagedResponse{} - err := c.listHelper(ctx, &response, opts) + response, err := getPaginatedResults[Domain](ctx, c, "domains", opts) if err != nil { return nil, err } - return response.Data, nil + return response, nil } // GetDomain gets the domain with the provided ID func (c *Client) GetDomain(ctx context.Context, domainID int) (*Domain, error) { - req := c.R(ctx).SetResult(&Domain{}) - e := fmt.Sprintf("domains/%d", domainID) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("domains/%d", domainID) + response, err := doGETRequest[Domain](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*Domain), nil + return response, nil } // CreateDomain creates a Domain func (c *Client) CreateDomain(ctx context.Context, opts DomainCreateOptions) (*Domain, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - - req := c.R(ctx).SetResult(&Domain{}).SetBody(string(body)) e := "domains" - r, err := coupleAPIErrors(req.Post(e)) + response, err := doPOSTRequest[Domain](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*Domain), nil + return response, nil } // UpdateDomain updates the Domain with the specified id func (c *Client) UpdateDomain(ctx context.Context, domainID int, opts DomainUpdateOptions) (*Domain, error) { - body, err := json.Marshal(opts) - if err != nil { - return nil, err - } - - e := fmt.Sprintf("domains/%d", domainID) - req := c.R(ctx).SetResult(&Domain{}).SetBody(string(body)) - r, err := coupleAPIErrors(req.Put(e)) + e := formatAPIPath("domains/%d", domainID) + response, err := doPUTRequest[Domain](ctx, c, e, opts) if err != nil { return nil, err } - return r.Result().(*Domain), nil + return response, nil } // DeleteDomain deletes the Domain with the specified id func (c *Client) DeleteDomain(ctx context.Context, domainID int) error { - e := fmt.Sprintf("domains/%d", domainID) - _, err := coupleAPIErrors(c.R(ctx).Delete(e)) + e := formatAPIPath("domains/%d", domainID) + err := doDELETERequest(ctx, c, e) return err } // GetDomainZoneFile gets the zone file for the last rendered zone for the specified domain. func (c *Client) GetDomainZoneFile(ctx context.Context, domainID int) (*DomainZoneFile, error) { - e := fmt.Sprintf("domains/%d/zone-file", domainID) - req := c.R(ctx).SetResult(&DomainZoneFile{}) - resp, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("domains/%d/zone-file", domainID) + response, err := doGETRequest[DomainZoneFile](ctx, c, e) if err != nil { return nil, err } - return resp.Result().(*DomainZoneFile), nil + return response, nil } diff --git a/vendor/github.com/linode/linodego/firewall_devices.go b/vendor/github.com/linode/linodego/firewall_devices.go index 901cf43d..91896d28 100644 --- a/vendor/github.com/linode/linodego/firewall_devices.go +++ b/vendor/github.com/linode/linodego/firewall_devices.go @@ -3,10 +3,8 @@ package linodego import ( "context" "encoding/json" - "fmt" "time" - "github.com/go-resty/resty/v2" "github.com/linode/linodego/internal/parseabletime" ) @@ -62,68 +60,41 @@ type FirewallDeviceEntity struct { URL string `json:"url"` } -// FirewallDevicesPagedResponse represents a Linode API response for FirewallDevices -type FirewallDevicesPagedResponse struct { - *PageOptions - Data []FirewallDevice `json:"data"` -} - -// endpoint gets the endpoint URL for FirewallDevices of a given Firewall -func (FirewallDevicesPagedResponse) endpoint(ids ...any) string { - id, _ := ids[0].(int) - return fmt.Sprintf("networking/firewalls/%d/devices", id) -} - -func (resp *FirewallDevicesPagedResponse) castResult(r *resty.Request, e string) (int, int, error) { - res, err := coupleAPIErrors(r.SetResult(FirewallDevicesPagedResponse{}).Get(e)) - if err != nil { - return 0, 0, err - } - castedRes := res.Result().(*FirewallDevicesPagedResponse) - resp.Data = append(resp.Data, castedRes.Data...) - return castedRes.Pages, castedRes.Results, nil -} - // ListFirewallDevices get devices associated with a given Firewall func (c *Client) ListFirewallDevices(ctx context.Context, firewallID int, opts *ListOptions) ([]FirewallDevice, error) { - response := FirewallDevicesPagedResponse{} - err := c.listHelper(ctx, &response, opts, firewallID) + response, err := getPaginatedResults[FirewallDevice](ctx, c, formatAPIPath("networking/firewalls/%d/devices", firewallID), opts) if err != nil { return nil, err } - return response.Data, nil + + return response, nil } // GetFirewallDevice gets a FirewallDevice given an ID func (c *Client) GetFirewallDevice(ctx context.Context, firewallID, deviceID int) (*FirewallDevice, error) { - e := fmt.Sprintf("networking/firewalls/%d/devices/%d", firewallID, deviceID) - req := c.R(ctx).SetResult(&FirewallDevice{}) - r, err := coupleAPIErrors(req.Get(e)) + e := formatAPIPath("networking/firewalls/%d/devices/%d", firewallID, deviceID) + response, err := doGETRequest[FirewallDevice](ctx, c, e) if err != nil { return nil, err } - return r.Result().(*FirewallDevice), nil + + return response, nil } // AddFirewallDevice associates a Device with a given Firewall func (c *Client) CreateFirewallDevice(ctx context.Context, firewallID int, opts FirewallDeviceCreateOptions) (*FirewallDevice, error) { - body, err := json.Marshal(opts) + e := formatAPIPath("networking/firewalls/%d/devices", firewallID) + response, err := doPOSTRequest[FirewallDevice](ctx, c, e, opts) if err != nil { return nil, err } - e := fmt.Sprintf("networking/firewalls/%d/devices", firewallID) - req := c.R(ctx).SetResult(&FirewallDevice{}).SetBody(string(body)) - r, err := coupleAPIErrors(req.Post(e)) - if err != nil { - return nil, err - } - return r.Result().(*FirewallDevice), nil + return response, nil } // DeleteFirewallDevice disassociates a Device with a given Firewall func (c *Client) DeleteFirewallDevice(ctx context.Context, firewallID, deviceID int) error { - e := fmt.Sprintf("networking/firewalls/%d/devices/%d", firewallID, deviceID) - _, err := coupleAPIErrors(c.R(ctx).Delete(e)) + e := formatAPIPath("networking/firewalls/%d/devices/%d", firewallID, deviceID) + err := doDELETERequest(ctx, c, e) return err } diff --git a/vendor/github.com/linode/linodego/request_helpers.go b/vendor/github.com/linode/linodego/request_helpers.go index 49b5dc40..747c8c4e 100644 --- a/vendor/github.com/linode/linodego/request_helpers.go +++ b/vendor/github.com/linode/linodego/request_helpers.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "net/url" - "strconv" ) // paginatedResponse represents a single response from a paginated @@ -30,8 +29,6 @@ func getPaginatedResults[T any]( result := make([]T, 0) - req := client.R(ctx).SetResult(resultType) - if opts == nil { opts = &ListOptions{PageOptions: &PageOptions{Page: 0}} } @@ -40,15 +37,20 @@ func getPaginatedResults[T any]( opts.PageOptions = &PageOptions{Page: 0} } - // Apply all user-provided list options to the base request - if err := applyListOptionsToRequest(opts, req); err != nil { - return nil, err - } - // Makes a request to a particular page and // appends the response to the result handlePage := func(page int) error { - req.SetQueryParam("page", strconv.Itoa(page)) + // Override the page to be applied in applyListOptionsToRequest(...) + opts.Page = page + + // This request object cannot be reused for each page request + // because it can lead to possible data corruption + req := client.R(ctx).SetResult(resultType) + + // Apply all user-provided list options to the request + if err := applyListOptionsToRequest(opts, req); err != nil { + return err + } res, err := coupleAPIErrors(req.Get(endpoint)) if err != nil { diff --git a/vendor/google.golang.org/api/compute/v1/compute-api.json b/vendor/google.golang.org/api/compute/v1/compute-api.json index 61ccfc4f..267496ed 100644 --- a/vendor/google.golang.org/api/compute/v1/compute-api.json +++ b/vendor/google.golang.org/api/compute/v1/compute-api.json @@ -32401,7 +32401,7 @@ ] }, "update": { - "description": "Updates the specified storagePool with the data included in the request. The update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: size_tb and provisioned_iops.", + "description": "Updates the specified storagePool with the data included in the request. The update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: pool_provisioned_capacity_gb, pool_provisioned_iops and pool_provisioned_throughput.", "flatPath": "projects/{project}/zones/{zone}/storagePools/{storagePool}", "httpMethod": "PATCH", "id": "compute.storagePools.update", @@ -37421,7 +37421,7 @@ } } }, - "revision": "20240604", + "revision": "20240618", "rootUrl": "https://compute.googleapis.com/", "schemas": { "AWSV4Signature": { @@ -42935,6 +42935,47 @@ }, "type": "object" }, + "CustomErrorResponsePolicy": { + "description": "Specifies the custom error response policy that must be applied when the backend service or backend bucket responds with an error.", + "id": "CustomErrorResponsePolicy", + "properties": { + "errorResponseRules": { + "description": "Specifies rules for returning error responses. In a given policy, if you specify rules for both a range of error codes as well as rules for specific error codes then rules with specific error codes have a higher priority. For example, assume that you configure a rule for 401 (Un-authorized) code, and another for all 4 series error codes (4XX). If the backend service returns a 401, then the rule for 401 will be applied. However if the backend service returns a 403, the rule for 4xx takes effect.", + "items": { + "$ref": "CustomErrorResponsePolicyCustomErrorResponseRule" + }, + "type": "array" + }, + "errorService": { + "description": "The full or partial URL to the BackendBucket resource that contains the custom error content. Examples are: - https://www.googleapis.com/compute/v1/projects/project/global/backendBuckets/myBackendBucket - compute/v1/projects/project/global/backendBuckets/myBackendBucket - global/backendBuckets/myBackendBucket If errorService is not specified at lower levels like pathMatcher, pathRule and routeRule, an errorService specified at a higher level in the UrlMap will be used. If UrlMap.defaultCustomErrorResponsePolicy contains one or more errorResponseRules[], it must specify errorService. If load balancer cannot reach the backendBucket, a simple Not Found Error will be returned, with the original response code (or overrideResponseCode if configured). errorService is not supported for internal or regional HTTP/HTTPS load balancers.", + "type": "string" + } + }, + "type": "object" + }, + "CustomErrorResponsePolicyCustomErrorResponseRule": { + "description": "Specifies the mapping between the response code that will be returned along with the custom error content and the response code returned by the backend service.", + "id": "CustomErrorResponsePolicyCustomErrorResponseRule", + "properties": { + "matchResponseCodes": { + "description": "Valid values include: - A number between 400 and 599: For example 401 or 503, in which case the load balancer applies the policy if the error code exactly matches this value. - 5xx: Load Balancer will apply the policy if the backend service responds with any response code in the range of 500 to 599. - 4xx: Load Balancer will apply the policy if the backend service responds with any response code in the range of 400 to 499. Values must be unique within matchResponseCodes and across all errorResponseRules of CustomErrorResponsePolicy.", + "items": { + "type": "string" + }, + "type": "array" + }, + "overrideResponseCode": { + "description": "The HTTP status code returned with the response containing the custom error content. If overrideResponseCode is not supplied, the same response code returned by the original backend bucket or backend service is returned to the client.", + "format": "int32", + "type": "integer" + }, + "path": { + "description": "The full path to a file within backendBucket . For example: /errors/defaultError.html path must start with a leading slash. path cannot have trailing slashes. If the file is not available in backendBucket or the load balancer cannot reach the BackendBucket, a simple Not Found Error is returned to the client. The value must be from 1 to 1024 characters", + "type": "string" + } + }, + "type": "object" + }, "CustomerEncryptionKey": { "id": "CustomerEncryptionKey", "properties": { @@ -48419,6 +48460,10 @@ "description": "The HttpRouteRule setting specifies how to match an HTTP request and the corresponding routing action that load balancing proxies perform.", "id": "HttpRouteRule", "properties": { + "customErrorResponsePolicy": { + "$ref": "CustomErrorResponsePolicy", + "description": "customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the RouteRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A RouteRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in RouteRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. When used in conjunction with routeRules.routeAction.retryPolicy, retries take precedence. Only once all retries are exhausted, the customErrorResponsePolicy is applied. While attempting a retry, if load balancer is successful in reaching the service, the customErrorResponsePolicy is ignored and the response from the service is returned to the client. customErrorResponsePolicy is supported only for global external Application Load Balancers." + }, "description": { "description": "The short description conveying the intent of this routeRule. The description can have a maximum length of 1024 characters.", "type": "string" @@ -52388,7 +52433,7 @@ "compute.instanceTemplates.insert" ] }, - "description": "The machine type to use for instances that are created from these properties. This field only accept machine types name. e.g. n2-standard-4 and does not accept machine type full or partial url. e.g. projects/my-l7ilb-project/zones/us-central1-a/machineTypes/n2-standard-4 will throw INTERNAL_ERROR.", + "description": "The machine type to use for instances that are created from these properties. This field only accepts a machine type name, for example `n2-standard-4`. If you use the machine type full or partial URL, for example `projects/my-l7ilb-project/zones/us-central1-a/machineTypes/n2-standard-4`, the request will result in an `INTERNAL_ERROR`.", "type": "string" }, "metadata": { @@ -63987,6 +64032,10 @@ "description": "A matcher for the path portion of the URL. The BackendService from the longest-matched rule will serve the URL. If no rule was matched, the default service is used.", "id": "PathMatcher", "properties": { + "defaultCustomErrorResponsePolicy": { + "$ref": "CustomErrorResponsePolicy", + "description": "defaultCustomErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. This policy takes effect at the PathMatcher level and applies only when no policy has been defined for the error code at lower levels like RouteRule and PathRule within this PathMatcher. If an error code does not have a policy defined in defaultCustomErrorResponsePolicy, then a policy defined for the error code in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy is configured with policies for 5xx and 4xx errors - A RouteRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in RouteRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. When used in conjunction with pathMatcher.defaultRouteAction.retryPolicy, retries take precedence. Only once all retries are exhausted, the defaultCustomErrorResponsePolicy is applied. While attempting a retry, if load balancer is successful in reaching the service, the defaultCustomErrorResponsePolicy is ignored and the response from the service is returned to the client. defaultCustomErrorResponsePolicy is supported only for global external Application Load Balancers." + }, "defaultRouteAction": { "$ref": "HttpRouteAction", "description": "defaultRouteAction takes effect when none of the pathRules or routeRules match. The load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If defaultRouteAction specifies any weightedBackendServices, defaultService must not be set. Conversely if defaultService is set, defaultRouteAction cannot contain any weightedBackendServices. If defaultRouteAction is specified, don't set defaultUrlRedirect. If defaultRouteAction.weightedBackendServices is specified, don't set defaultService. URL maps for classic Application Load Balancers only support the urlRewrite action within a path matcher's defaultRouteAction." @@ -64032,6 +64081,10 @@ "description": "A path-matching rule for a URL. If matched, will use the specified BackendService to handle the traffic arriving at this URL.", "id": "PathRule", "properties": { + "customErrorResponsePolicy": { + "$ref": "CustomErrorResponsePolicy", + "description": "customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A PathRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. customErrorResponsePolicy is supported only for global external Application Load Balancers." + }, "paths": { "description": "The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.", "items": { @@ -69024,7 +69077,7 @@ "type": "string" }, "nextHopIlb": { - "description": "The URL to a forwarding rule of type loadBalancingScheme=INTERNAL that should handle matching packets or the IP address of the forwarding Rule. For example, the following are all valid URLs: - 10.128.0.56 - https://www.googleapis.com/compute/v1/projects/project/regions/region /forwardingRules/forwardingRule - regions/region/forwardingRules/forwardingRule ", + "description": "The URL to a forwarding rule of type loadBalancingScheme=INTERNAL that should handle matching packets or the IP address of the forwarding Rule. For example, the following are all valid URLs: - https://www.googleapis.com/compute/v1/projects/project/regions/region /forwardingRules/forwardingRule - regions/region/forwardingRules/forwardingRule If an IP address is provided, must specify an IPv4 address in dot-decimal notation or an IPv6 address in RFC 4291 format. For example, the following are all valid IP addresses: - 10.128.0.56 - 2001:db8::2d9:51:0:0 - 2001:db8:0:0:2d9:51:0:0 IPv6 addresses will be displayed using RFC 5952 compressed format (e.g. 2001:db8::2d9:51:0:0). Should never be an IPv4-mapped IPv6 address.", "type": "string" }, "nextHopInstance": { @@ -70372,7 +70425,7 @@ "type": "string" }, "match": { - "description": "CEL expression that specifies the match condition that egress traffic from a VM is evaluated against. If it evaluates to true, the corresponding `action` is enforced. The following examples are valid match expressions for public NAT: \"inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')\" \"destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'\" The following example is a valid match expression for private NAT: \"nexthop.hub == '//networkconnectivity.googleapis.com/projects/my-project/locations/global/hubs/hub-1'\"", + "description": "CEL expression that specifies the match condition that egress traffic from a VM is evaluated against. If it evaluates to true, the corresponding `action` is enforced. The following examples are valid match expressions for public NAT: `inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')` `destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'` The following example is a valid match expression for private NAT: `nexthop.hub == '//networkconnectivity.googleapis.com/projects/my-project/locations/global/hubs/hub-1'`", "type": "string" }, "ruleNumber": { @@ -70456,14 +70509,14 @@ "id": "RouterStatus", "properties": { "bestRoutes": { - "description": "Best routes for this router's network.", + "description": "A list of the best dynamic routes for this Cloud Router's Virtual Private Cloud (VPC) network in the same region as this Cloud Router. Lists all of the best routes per prefix that are programmed into this region's VPC data plane. When global dynamic routing mode is turned on in the VPC network, this list can include cross-region dynamic routes from Cloud Routers in other regions.", "items": { "$ref": "Route" }, "type": "array" }, "bestRoutesForRouter": { - "description": "Best routes learned by this router.", + "description": "A list of the best BGP routes learned by this Cloud Router. It is possible that routes listed might not be programmed into the data plane, if the Google Cloud control plane finds a more optimal route for a prefix than a route learned by this Cloud Router.", "items": { "$ref": "Route" }, @@ -71773,10 +71826,58 @@ "format": "float", "type": "number" }, + "detectionAbsoluteQps": { + "format": "float", + "type": "number" + }, + "detectionLoadThreshold": { + "format": "float", + "type": "number" + }, + "detectionRelativeToBaselineQps": { + "format": "float", + "type": "number" + }, "name": { "description": "The name must be 1-63 characters long, and comply with RFC1035. The name must be unique within the security policy.", "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", "type": "string" + }, + "trafficGranularityConfigs": { + "description": "Configuration options for enabling Adaptive Protection to operate on specified granular traffic units.", + "items": { + "$ref": "SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig" + }, + "type": "array" + } + }, + "type": "object" + }, + "SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig": { + "description": "Configurations to specifc granular traffic units processed by Adaptive Protection.", + "id": "SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig", + "properties": { + "enableEachUniqueValue": { + "description": "If enabled, traffic matching each unique value for the specified type constitutes a separate traffic unit. It can only be set to true if `value` is empty.", + "type": "boolean" + }, + "type": { + "description": "Type of this configuration.", + "enum": [ + "HTTP_HEADER_HOST", + "HTTP_PATH", + "UNSPECIFIED_TYPE" + ], + "enumDescriptions": [ + "", + "", + "" + ], + "type": "string" + }, + "value": { + "description": "Requests that match this value constitute a granular traffic unit.", + "type": "string" } }, "type": "object" @@ -75394,7 +75495,12 @@ "type": "string" }, "poolProvisionedCapacityGb": { - "description": "Size, in GiB, of the storage pool.", + "annotations": { + "required": [ + "compute.storagePools.insert" + ] + }, + "description": "Size, in GiB, of the storage pool. For more information about the size limits, see https://cloud.google.com/compute/docs/disks/storage-pools.", "format": "int64", "type": "string" }, @@ -76036,7 +76142,7 @@ "type": "string" }, "poolUsedIops": { - "description": "Sum of all the disks' provisioned IOPS, minus some amount that is allowed per disk that is not counted towards pool's IOPS capacity.", + "description": "[Output Only] Sum of all the disks' provisioned IOPS, minus some amount that is allowed per disk that is not counted towards pool's IOPS capacity. For more information, see https://cloud.google.com/compute/docs/disks/storage-pools.", "format": "int64", "type": "string" }, @@ -81314,6 +81420,10 @@ "description": "[Output Only] Creation timestamp in RFC3339 text format.", "type": "string" }, + "defaultCustomErrorResponsePolicy": { + "$ref": "CustomErrorResponsePolicy", + "description": "defaultCustomErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. This policy takes effect at the load balancer level and applies only when no policy has been defined for the error code at lower levels like PathMatcher, RouteRule and PathRule within this UrlMap. For example, consider a UrlMap with the following configuration: - defaultCustomErrorResponsePolicy containing policies for responding to 5xx and 4xx errors - A PathMatcher configured for *.example.com has defaultCustomErrorResponsePolicy for 4xx. If a request for http://www.example.com/ encounters a 404, the policy in pathMatcher.defaultCustomErrorResponsePolicy will be enforced. When the request for http://www.example.com/ encounters a 502, the policy in UrlMap.defaultCustomErrorResponsePolicy will be enforced. When a request that does not match any host in *.example.com such as http://www.myotherexample.com/, encounters a 404, UrlMap.defaultCustomErrorResponsePolicy takes effect. When used in conjunction with defaultRouteAction.retryPolicy, retries take precedence. Only once all retries are exhausted, the defaultCustomErrorResponsePolicy is applied. While attempting a retry, if load balancer is successful in reaching the service, the defaultCustomErrorResponsePolicy is ignored and the response from the service is returned to the client. defaultCustomErrorResponsePolicy is supported only for global external Application Load Balancers." + }, "defaultRouteAction": { "$ref": "HttpRouteAction", "description": "defaultRouteAction takes effect when none of the hostRules match. The load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If defaultRouteAction specifies any weightedBackendServices, defaultService must not be set. Conversely if defaultService is set, defaultRouteAction cannot contain any weightedBackendServices. Only one of defaultRouteAction or defaultUrlRedirect must be set. URL maps for classic Application Load Balancers only support the urlRewrite action within defaultRouteAction. defaultRouteAction has no effect when the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true." diff --git a/vendor/google.golang.org/api/compute/v1/compute-gen.go b/vendor/google.golang.org/api/compute/v1/compute-gen.go index 3998ee08..323f5aaf 100644 --- a/vendor/google.golang.org/api/compute/v1/compute-gen.go +++ b/vendor/google.golang.org/api/compute/v1/compute-gen.go @@ -7817,6 +7817,91 @@ func (s *CorsPolicy) MarshalJSON() ([]byte, error) { return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) } +// CustomErrorResponsePolicy: Specifies the custom error response policy that +// must be applied when the backend service or backend bucket responds with an +// error. +type CustomErrorResponsePolicy struct { + // ErrorResponseRules: Specifies rules for returning error responses. In a + // given policy, if you specify rules for both a range of error codes as well + // as rules for specific error codes then rules with specific error codes have + // a higher priority. For example, assume that you configure a rule for 401 + // (Un-authorized) code, and another for all 4 series error codes (4XX). If the + // backend service returns a 401, then the rule for 401 will be applied. + // However if the backend service returns a 403, the rule for 4xx takes effect. + ErrorResponseRules []*CustomErrorResponsePolicyCustomErrorResponseRule `json:"errorResponseRules,omitempty"` + // ErrorService: The full or partial URL to the BackendBucket resource that + // contains the custom error content. Examples are: - + // https://www.googleapis.com/compute/v1/projects/project/global/backendBuckets/myBackendBucket + // - compute/v1/projects/project/global/backendBuckets/myBackendBucket - + // global/backendBuckets/myBackendBucket If errorService is not specified at + // lower levels like pathMatcher, pathRule and routeRule, an errorService + // specified at a higher level in the UrlMap will be used. If + // UrlMap.defaultCustomErrorResponsePolicy contains one or more + // errorResponseRules[], it must specify errorService. If load balancer cannot + // reach the backendBucket, a simple Not Found Error will be returned, with the + // original response code (or overrideResponseCode if configured). errorService + // is not supported for internal or regional HTTP/HTTPS load balancers. + ErrorService string `json:"errorService,omitempty"` + // ForceSendFields is a list of field names (e.g. "ErrorResponseRules") to + // unconditionally include in API requests. By default, fields with empty or + // default values are omitted from API requests. See + // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more + // details. + ForceSendFields []string `json:"-"` + // NullFields is a list of field names (e.g. "ErrorResponseRules") to include + // in API requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. See + // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. + NullFields []string `json:"-"` +} + +func (s *CustomErrorResponsePolicy) MarshalJSON() ([]byte, error) { + type NoMethod CustomErrorResponsePolicy + return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) +} + +// CustomErrorResponsePolicyCustomErrorResponseRule: Specifies the mapping +// between the response code that will be returned along with the custom error +// content and the response code returned by the backend service. +type CustomErrorResponsePolicyCustomErrorResponseRule struct { + // MatchResponseCodes: Valid values include: - A number between 400 and 599: + // For example 401 or 503, in which case the load balancer applies the policy + // if the error code exactly matches this value. - 5xx: Load Balancer will + // apply the policy if the backend service responds with any response code in + // the range of 500 to 599. - 4xx: Load Balancer will apply the policy if the + // backend service responds with any response code in the range of 400 to 499. + // Values must be unique within matchResponseCodes and across all + // errorResponseRules of CustomErrorResponsePolicy. + MatchResponseCodes []string `json:"matchResponseCodes,omitempty"` + // OverrideResponseCode: The HTTP status code returned with the response + // containing the custom error content. If overrideResponseCode is not + // supplied, the same response code returned by the original backend bucket or + // backend service is returned to the client. + OverrideResponseCode int64 `json:"overrideResponseCode,omitempty"` + // Path: The full path to a file within backendBucket . For example: + // /errors/defaultError.html path must start with a leading slash. path cannot + // have trailing slashes. If the file is not available in backendBucket or the + // load balancer cannot reach the BackendBucket, a simple Not Found Error is + // returned to the client. The value must be from 1 to 1024 characters + Path string `json:"path,omitempty"` + // ForceSendFields is a list of field names (e.g. "MatchResponseCodes") to + // unconditionally include in API requests. By default, fields with empty or + // default values are omitted from API requests. See + // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more + // details. + ForceSendFields []string `json:"-"` + // NullFields is a list of field names (e.g. "MatchResponseCodes") to include + // in API requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. See + // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. + NullFields []string `json:"-"` +} + +func (s *CustomErrorResponsePolicyCustomErrorResponseRule) MarshalJSON() ([]byte, error) { + type NoMethod CustomErrorResponsePolicyCustomErrorResponseRule + return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) +} + type CustomerEncryptionKey struct { // KmsKeyName: The name of the encryption key that is stored in Google Cloud // KMS. For example: "kmsKeyName": @@ -14361,6 +14446,32 @@ func (s *HttpRouteAction) MarshalJSON() ([]byte, error) { // request and the corresponding routing action that load balancing proxies // perform. type HttpRouteRule struct { + // CustomErrorResponsePolicy: customErrorResponsePolicy specifies how the Load + // Balancer returns error responses when BackendServiceor BackendBucket + // responds with an error. If a policy for an error code is not configured for + // the RouteRule, a policy for the error code configured in + // pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not + // specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy + // configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For + // example, consider a UrlMap with the following configuration: - + // UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx + // and 4xx errors - A RouteRule for /coming_soon/ is configured for the error + // code 404. If the request is for www.myotherdomain.com and a 404 is + // encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes + // effect. If a 404 response is encountered for the request + // www.example.com/current_events/, the pathMatcher's policy takes effect. If + // however, the request for www.example.com/coming_soon/ encounters a 404, the + // policy in RouteRule.customErrorResponsePolicy takes effect. If any of the + // requests in this example encounter a 500 error code, the policy at + // UrlMap.defaultCustomErrorResponsePolicy takes effect. When used in + // conjunction with routeRules.routeAction.retryPolicy, retries take + // precedence. Only once all retries are exhausted, the + // customErrorResponsePolicy is applied. While attempting a retry, if load + // balancer is successful in reaching the service, the + // customErrorResponsePolicy is ignored and the response from the service is + // returned to the client. customErrorResponsePolicy is supported only for + // global external Application Load Balancers. + CustomErrorResponsePolicy *CustomErrorResponsePolicy `json:"customErrorResponsePolicy,omitempty"` // Description: The short description conveying the intent of this routeRule. // The description can have a maximum length of 1024 characters. Description string `json:"description,omitempty"` @@ -14415,15 +14526,15 @@ type HttpRouteRule struct { // routeAction must not be set. Not supported when the URL map is bound to a // target gRPC proxy. UrlRedirect *HttpRedirectAction `json:"urlRedirect,omitempty"` - // ForceSendFields is a list of field names (e.g. "Description") to - // unconditionally include in API requests. By default, fields with empty or + // ForceSendFields is a list of field names (e.g. "CustomErrorResponsePolicy") + // to unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` - // NullFields is a list of field names (e.g. "Description") to include in API - // requests with the JSON null value. By default, fields with empty values are - // omitted from API requests. See + // NullFields is a list of field names (e.g. "CustomErrorResponsePolicy") to + // include in API requests with the JSON null value. By default, fields with + // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } @@ -18851,10 +18962,11 @@ type InstanceProperties struct { // Labels: Labels to apply to instances that are created from these properties. Labels map[string]string `json:"labels,omitempty"` // MachineType: The machine type to use for instances that are created from - // these properties. This field only accept machine types name. e.g. - // n2-standard-4 and does not accept machine type full or partial url. e.g. - // projects/my-l7ilb-project/zones/us-central1-a/machineTypes/n2-standard-4 - // will throw INTERNAL_ERROR. + // these properties. This field only accepts a machine type name, for example + // `n2-standard-4`. If you use the machine type full or partial URL, for + // example + // `projects/my-l7ilb-project/zones/us-central1-a/machineTypes/n2-standard-4`, + // the request will result in an `INTERNAL_ERROR`. MachineType string `json:"machineType,omitempty"` // Metadata: The metadata key/value pairs to assign to instances that are // created from these properties. These pairs can consist of custom metadata or @@ -31498,6 +31610,33 @@ func (s *PacketMirroringsScopedListWarningData) MarshalJSON() ([]byte, error) { // from the longest-matched rule will serve the URL. If no rule was matched, // the default service is used. type PathMatcher struct { + // DefaultCustomErrorResponsePolicy: defaultCustomErrorResponsePolicy specifies + // how the Load Balancer returns error responses when BackendServiceor + // BackendBucket responds with an error. This policy takes effect at the + // PathMatcher level and applies only when no policy has been defined for the + // error code at lower levels like RouteRule and PathRule within this + // PathMatcher. If an error code does not have a policy defined in + // defaultCustomErrorResponsePolicy, then a policy defined for the error code + // in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, + // consider a UrlMap with the following configuration: - + // UrlMap.defaultCustomErrorResponsePolicy is configured with policies for 5xx + // and 4xx errors - A RouteRule for /coming_soon/ is configured for the error + // code 404. If the request is for www.myotherdomain.com and a 404 is + // encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes + // effect. If a 404 response is encountered for the request + // www.example.com/current_events/, the pathMatcher's policy takes effect. If + // however, the request for www.example.com/coming_soon/ encounters a 404, the + // policy in RouteRule.customErrorResponsePolicy takes effect. If any of the + // requests in this example encounter a 500 error code, the policy at + // UrlMap.defaultCustomErrorResponsePolicy takes effect. When used in + // conjunction with pathMatcher.defaultRouteAction.retryPolicy, retries take + // precedence. Only once all retries are exhausted, the + // defaultCustomErrorResponsePolicy is applied. While attempting a retry, if + // load balancer is successful in reaching the service, the + // defaultCustomErrorResponsePolicy is ignored and the response from the + // service is returned to the client. defaultCustomErrorResponsePolicy is + // supported only for global external Application Load Balancers. + DefaultCustomErrorResponsePolicy *CustomErrorResponsePolicy `json:"defaultCustomErrorResponsePolicy,omitempty"` // DefaultRouteAction: defaultRouteAction takes effect when none of the // pathRules or routeRules match. The load balancer performs advanced routing // actions, such as URL rewrites and header transformations, before forwarding @@ -31560,16 +31699,18 @@ type PathMatcher struct { // evaluated in order of priority, from the lowest to highest number. Within a // given pathMatcher, you can set only one of pathRules or routeRules. RouteRules []*HttpRouteRule `json:"routeRules,omitempty"` - // ForceSendFields is a list of field names (e.g. "DefaultRouteAction") to - // unconditionally include in API requests. By default, fields with empty or - // default values are omitted from API requests. See + // ForceSendFields is a list of field names (e.g. + // "DefaultCustomErrorResponsePolicy") to unconditionally include in API + // requests. By default, fields with empty or default values are omitted from + // API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` - // NullFields is a list of field names (e.g. "DefaultRouteAction") to include - // in API requests with the JSON null value. By default, fields with empty - // values are omitted from API requests. See - // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. + // NullFields is a list of field names (e.g. + // "DefaultCustomErrorResponsePolicy") to include in API requests with the JSON + // null value. By default, fields with empty values are omitted from API + // requests. See https://pkg.go.dev/google.golang.org/api#hdr-NullFields for + // more details. NullFields []string `json:"-"` } @@ -31581,6 +31722,27 @@ func (s *PathMatcher) MarshalJSON() ([]byte, error) { // PathRule: A path-matching rule for a URL. If matched, will use the specified // BackendService to handle the traffic arriving at this URL. type PathRule struct { + // CustomErrorResponsePolicy: customErrorResponsePolicy specifies how the Load + // Balancer returns error responses when BackendServiceor BackendBucket + // responds with an error. If a policy for an error code is not configured for + // the PathRule, a policy for the error code configured in + // pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not + // specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy + // configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For + // example, consider a UrlMap with the following configuration: - + // UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx + // and 4xx errors - A PathRule for /coming_soon/ is configured for the error + // code 404. If the request is for www.myotherdomain.com and a 404 is + // encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes + // effect. If a 404 response is encountered for the request + // www.example.com/current_events/, the pathMatcher's policy takes effect. If + // however, the request for www.example.com/coming_soon/ encounters a 404, the + // policy in PathRule.customErrorResponsePolicy takes effect. If any of the + // requests in this example encounter a 500 error code, the policy at + // UrlMap.defaultCustomErrorResponsePolicy takes effect. + // customErrorResponsePolicy is supported only for global external Application + // Load Balancers. + CustomErrorResponsePolicy *CustomErrorResponsePolicy `json:"customErrorResponsePolicy,omitempty"` // Paths: The list of path patterns to match. Each must start with / and the // only place a * is allowed is at the end following a /. The string fed to the // path matcher does not include any text after the first ? or #, and those @@ -31609,15 +31771,15 @@ type PathRule struct { // routeAction must not be set. Not supported when the URL map is bound to a // target gRPC proxy. UrlRedirect *HttpRedirectAction `json:"urlRedirect,omitempty"` - // ForceSendFields is a list of field names (e.g. "Paths") to unconditionally - // include in API requests. By default, fields with empty or default values are - // omitted from API requests. See + // ForceSendFields is a list of field names (e.g. "CustomErrorResponsePolicy") + // to unconditionally include in API requests. By default, fields with empty or + // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` - // NullFields is a list of field names (e.g. "Paths") to include in API - // requests with the JSON null value. By default, fields with empty values are - // omitted from API requests. See + // NullFields is a list of field names (e.g. "CustomErrorResponsePolicy") to + // include in API requests with the JSON null value. By default, fields with + // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` } @@ -37018,10 +37180,15 @@ type Route struct { // NextHopIlb: The URL to a forwarding rule of type // loadBalancingScheme=INTERNAL that should handle matching packets or the IP // address of the forwarding Rule. For example, the following are all valid - // URLs: - 10.128.0.56 - + // URLs: - // https://www.googleapis.com/compute/v1/projects/project/regions/region // /forwardingRules/forwardingRule - - // regions/region/forwardingRules/forwardingRule + // regions/region/forwardingRules/forwardingRule If an IP address is provided, + // must specify an IPv4 address in dot-decimal notation or an IPv6 address in + // RFC 4291 format. For example, the following are all valid IP addresses: - + // 10.128.0.56 - 2001:db8::2d9:51:0:0 - 2001:db8:0:0:2d9:51:0:0 IPv6 addresses + // will be displayed using RFC 5952 compressed format (e.g. + // 2001:db8::2d9:51:0:0). Should never be an IPv4-mapped IPv6 address. NextHopIlb string `json:"nextHopIlb,omitempty"` // NextHopInstance: The URL to an instance that should handle matching packets. // You can specify this as a full or partial URL. For example: @@ -38379,12 +38546,12 @@ type RouterNatRule struct { // Match: CEL expression that specifies the match condition that egress traffic // from a VM is evaluated against. If it evaluates to true, the corresponding // `action` is enforced. The following examples are valid match expressions for - // public NAT: "inIpRange(destination.ip, '1.1.0.0/16') || - // inIpRange(destination.ip, '2.2.0.0/16')" "destination.ip == '1.1.0.1' || - // destination.ip == '8.8.8.8'" The following example is a valid match - // expression for private NAT: "nexthop.hub == + // public NAT: `inIpRange(destination.ip, '1.1.0.0/16') || + // inIpRange(destination.ip, '2.2.0.0/16')` `destination.ip == '1.1.0.1' || + // destination.ip == '8.8.8.8'` The following example is a valid match + // expression for private NAT: `nexthop.hub == // '//networkconnectivity.googleapis.com/projects/my-project/locations/global/hu - // bs/hub-1'" + // bs/hub-1'` Match string `json:"match,omitempty"` // RuleNumber: An integer uniquely identifying a rule in the list. The rule // number must be a positive value between 0 and 65000, and must be unique @@ -38487,9 +38654,17 @@ func (s *RouterNatSubnetworkToNat) MarshalJSON() ([]byte, error) { } type RouterStatus struct { - // BestRoutes: Best routes for this router's network. + // BestRoutes: A list of the best dynamic routes for this Cloud Router's + // Virtual Private Cloud (VPC) network in the same region as this Cloud Router. + // Lists all of the best routes per prefix that are programmed into this + // region's VPC data plane. When global dynamic routing mode is turned on in + // the VPC network, this list can include cross-region dynamic routes from + // Cloud Routers in other regions. BestRoutes []*Route `json:"bestRoutes,omitempty"` - // BestRoutesForRouter: Best routes learned by this router. + // BestRoutesForRouter: A list of the best BGP routes learned by this Cloud + // Router. It is possible that routes listed might not be programmed into the + // data plane, if the Google Cloud control plane finds a more optimal route for + // a prefix than a route learned by this Cloud Router. BestRoutesForRouter []*Route `json:"bestRoutesForRouter,omitempty"` BgpPeerStatus []*RouterStatusBgpPeerStatus `json:"bgpPeerStatus,omitempty"` NatStatus []*RouterStatusNatStatus `json:"natStatus,omitempty"` @@ -39833,9 +40008,15 @@ type SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfi AutoDeployExpirationSec int64 `json:"autoDeployExpirationSec,omitempty"` AutoDeployImpactedBaselineThreshold float64 `json:"autoDeployImpactedBaselineThreshold,omitempty"` AutoDeployLoadThreshold float64 `json:"autoDeployLoadThreshold,omitempty"` + DetectionAbsoluteQps float64 `json:"detectionAbsoluteQps,omitempty"` + DetectionLoadThreshold float64 `json:"detectionLoadThreshold,omitempty"` + DetectionRelativeToBaselineQps float64 `json:"detectionRelativeToBaselineQps,omitempty"` // Name: The name must be 1-63 characters long, and comply with RFC1035. The // name must be unique within the security policy. Name string `json:"name,omitempty"` + // TrafficGranularityConfigs: Configuration options for enabling Adaptive + // Protection to operate on specified granular traffic units. + TrafficGranularityConfigs []*SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig `json:"trafficGranularityConfigs,omitempty"` // ForceSendFields is a list of field names (e.g. // "AutoDeployConfidenceThreshold") to unconditionally include in API requests. // By default, fields with empty or default values are omitted from API @@ -39860,6 +40041,9 @@ func (s *SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdC AutoDeployConfidenceThreshold gensupport.JSONFloat64 `json:"autoDeployConfidenceThreshold"` AutoDeployImpactedBaselineThreshold gensupport.JSONFloat64 `json:"autoDeployImpactedBaselineThreshold"` AutoDeployLoadThreshold gensupport.JSONFloat64 `json:"autoDeployLoadThreshold"` + DetectionAbsoluteQps gensupport.JSONFloat64 `json:"detectionAbsoluteQps"` + DetectionLoadThreshold gensupport.JSONFloat64 `json:"detectionLoadThreshold"` + DetectionRelativeToBaselineQps gensupport.JSONFloat64 `json:"detectionRelativeToBaselineQps"` *NoMethod } s1.NoMethod = (*NoMethod)(s) @@ -39869,9 +40053,47 @@ func (s *SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdC s.AutoDeployConfidenceThreshold = float64(s1.AutoDeployConfidenceThreshold) s.AutoDeployImpactedBaselineThreshold = float64(s1.AutoDeployImpactedBaselineThreshold) s.AutoDeployLoadThreshold = float64(s1.AutoDeployLoadThreshold) + s.DetectionAbsoluteQps = float64(s1.DetectionAbsoluteQps) + s.DetectionLoadThreshold = float64(s1.DetectionLoadThreshold) + s.DetectionRelativeToBaselineQps = float64(s1.DetectionRelativeToBaselineQps) return nil } +// SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigT +// rafficGranularityConfig: Configurations to specifc granular traffic units +// processed by Adaptive Protection. +type SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig struct { + // EnableEachUniqueValue: If enabled, traffic matching each unique value for + // the specified type constitutes a separate traffic unit. It can only be set + // to true if `value` is empty. + EnableEachUniqueValue bool `json:"enableEachUniqueValue,omitempty"` + // Type: Type of this configuration. + // + // Possible values: + // "HTTP_HEADER_HOST" + // "HTTP_PATH" + // "UNSPECIFIED_TYPE" + Type string `json:"type,omitempty"` + // Value: Requests that match this value constitute a granular traffic unit. + Value string `json:"value,omitempty"` + // ForceSendFields is a list of field names (e.g. "EnableEachUniqueValue") to + // unconditionally include in API requests. By default, fields with empty or + // default values are omitted from API requests. See + // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more + // details. + ForceSendFields []string `json:"-"` + // NullFields is a list of field names (e.g. "EnableEachUniqueValue") to + // include in API requests with the JSON null value. By default, fields with + // empty values are omitted from API requests. See + // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. + NullFields []string `json:"-"` +} + +func (s *SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig) MarshalJSON() ([]byte, error) { + type NoMethod SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig + return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) +} + type SecurityPolicyAdvancedOptionsConfig struct { // JsonCustomConfig: Custom configuration to apply the JSON parsing. Only // applicable when json_parsing is set to STANDARD. @@ -43918,7 +44140,9 @@ type StoragePool struct { // pool disks' exclusive use. // "UNSPECIFIED" PerformanceProvisioningType string `json:"performanceProvisioningType,omitempty"` - // PoolProvisionedCapacityGb: Size, in GiB, of the storage pool. + // PoolProvisionedCapacityGb: Size, in GiB, of the storage pool. For more + // information about the size limits, see + // https://cloud.google.com/compute/docs/disks/storage-pools. PoolProvisionedCapacityGb int64 `json:"poolProvisionedCapacityGb,omitempty,string"` // PoolProvisionedIops: Provisioned IOPS of the storage pool. Only relevant if // the storage pool type is hyperdisk-balanced. @@ -44515,8 +44739,10 @@ type StoragePoolResourceStatus struct { // bytes written to the disks in the pool, in contrast to the capacity of those // disks. PoolUsedCapacityBytes int64 `json:"poolUsedCapacityBytes,omitempty,string"` - // PoolUsedIops: Sum of all the disks' provisioned IOPS, minus some amount that - // is allowed per disk that is not counted towards pool's IOPS capacity. + // PoolUsedIops: [Output Only] Sum of all the disks' provisioned IOPS, minus + // some amount that is allowed per disk that is not counted towards pool's IOPS + // capacity. For more information, see + // https://cloud.google.com/compute/docs/disks/storage-pools. PoolUsedIops int64 `json:"poolUsedIops,omitempty,string"` // PoolUsedThroughput: [Output Only] Sum of all the disks' provisioned // throughput in MB/s. @@ -50290,6 +50516,30 @@ func (s *UpcomingMaintenance) MarshalJSON() ([]byte, error) { type UrlMap struct { // CreationTimestamp: [Output Only] Creation timestamp in RFC3339 text format. CreationTimestamp string `json:"creationTimestamp,omitempty"` + // DefaultCustomErrorResponsePolicy: defaultCustomErrorResponsePolicy specifies + // how the Load Balancer returns error responses when BackendServiceor + // BackendBucket responds with an error. This policy takes effect at the load + // balancer level and applies only when no policy has been defined for the + // error code at lower levels like PathMatcher, RouteRule and PathRule within + // this UrlMap. For example, consider a UrlMap with the following + // configuration: - defaultCustomErrorResponsePolicy containing policies for + // responding to 5xx and 4xx errors - A PathMatcher configured for + // *.example.com has defaultCustomErrorResponsePolicy for 4xx. If a request for + // http://www.example.com/ encounters a 404, the policy in + // pathMatcher.defaultCustomErrorResponsePolicy will be enforced. When the + // request for http://www.example.com/ encounters a 502, the policy in + // UrlMap.defaultCustomErrorResponsePolicy will be enforced. When a request + // that does not match any host in *.example.com such as + // http://www.myotherexample.com/, encounters a 404, + // UrlMap.defaultCustomErrorResponsePolicy takes effect. When used in + // conjunction with defaultRouteAction.retryPolicy, retries take precedence. + // Only once all retries are exhausted, the defaultCustomErrorResponsePolicy is + // applied. While attempting a retry, if load balancer is successful in + // reaching the service, the defaultCustomErrorResponsePolicy is ignored and + // the response from the service is returned to the client. + // defaultCustomErrorResponsePolicy is supported only for global external + // Application Load Balancers. + DefaultCustomErrorResponsePolicy *CustomErrorResponsePolicy `json:"defaultCustomErrorResponsePolicy,omitempty"` // DefaultRouteAction: defaultRouteAction takes effect when none of the // hostRules match. The load balancer performs advanced routing actions, such // as URL rewrites and header transformations, before forwarding the request to diff --git a/vendor/google.golang.org/api/compute/v1/compute3-gen.go b/vendor/google.golang.org/api/compute/v1/compute3-gen.go index 254547bb..7c0982e9 100644 --- a/vendor/google.golang.org/api/compute/v1/compute3-gen.go +++ b/vendor/google.golang.org/api/compute/v1/compute3-gen.go @@ -34987,8 +34987,9 @@ type StoragePoolsUpdateCall struct { // Update: Updates the specified storagePool with the data included in the // request. The update is performed only on selected fields included as part of -// update-mask. Only the following fields can be modified: size_tb and -// provisioned_iops. +// update-mask. Only the following fields can be modified: +// pool_provisioned_capacity_gb, pool_provisioned_iops and +// pool_provisioned_throughput. // // - project: Project ID for this request. // - storagePool: The storagePool name for this request. diff --git a/vendor/google.golang.org/api/internal/gensupport/resumable.go b/vendor/google.golang.org/api/internal/gensupport/resumable.go index 08e7aace..f828ddb6 100644 --- a/vendor/google.golang.org/api/internal/gensupport/resumable.go +++ b/vendor/google.golang.org/api/internal/gensupport/resumable.go @@ -171,6 +171,10 @@ func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err if resp != nil && resp.Body != nil { resp.Body.Close() } + // If there were retries, indicate this in the error message and wrap the final error. + if rx.attempts > 1 { + return nil, fmt.Errorf("chunk upload failed after %d attempts;, final error: %w", rx.attempts, err) + } return nil, err } // This case is very unlikely but possible only if rx.ChunkRetryDeadline is diff --git a/vendor/google.golang.org/api/internal/version.go b/vendor/google.golang.org/api/internal/version.go index 720cba16..b6fd68d5 100644 --- a/vendor/google.golang.org/api/internal/version.go +++ b/vendor/google.golang.org/api/internal/version.go @@ -5,4 +5,4 @@ package internal // Version is the current tagged release of the library. -const Version = "0.185.0" +const Version = "0.187.0" diff --git a/vendor/kmodules.xyz/resource-metadata/crds/identity.k8s.appscode.com_siteinfos.yaml b/vendor/kmodules.xyz/resource-metadata/crds/identity.k8s.appscode.com_siteinfos.yaml index 707f72ce..5415cf5b 100644 --- a/vendor/kmodules.xyz/resource-metadata/crds/identity.k8s.appscode.com_siteinfos.yaml +++ b/vendor/kmodules.xyz/resource-metadata/crds/identity.k8s.appscode.com_siteinfos.yaml @@ -125,8 +125,58 @@ spec: description: 'Capacity represents the total resources of a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity' type: object + controlPlane: + properties: + allocatable: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Allocatable represents the resources of a node + that are available for scheduling. Defaults to Capacity. + type: object + capacity: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Capacity represents the total resources of a + node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity' + type: object + count: + type: integer + type: object count: type: integer + workers: + properties: + allocatable: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Allocatable represents the resources of a node + that are available for scheduling. Defaults to Capacity. + type: object + capacity: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Capacity represents the total resources of a + node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity' + type: object + count: + type: integer + type: object type: object version: description: 'Info contains versioning information. TODO: Add []string diff --git a/vendor/modules.txt b/vendor/modules.txt index 815ce78f..eae800b3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# cloud.google.com/go/auth v0.5.1 +# cloud.google.com/go/auth v0.6.1 ## explicit; go 1.20 cloud.google.com/go/auth cloud.google.com/go/auth/credentials @@ -95,7 +95,7 @@ github.com/Masterminds/semver/v3 # github.com/Masterminds/sprig/v3 v3.2.3 ## explicit; go 1.13 github.com/Masterminds/sprig/v3 -# github.com/aws/aws-sdk-go v1.54.6 +# github.com/aws/aws-sdk-go v1.54.15 ## explicit; go 1.19 github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/auth/bearer @@ -317,8 +317,8 @@ github.com/google/uuid ## explicit; go 1.19 github.com/googleapis/enterprise-certificate-proxy/client github.com/googleapis/enterprise-certificate-proxy/client/util -# github.com/googleapis/gax-go/v2 v2.12.4 -## explicit; go 1.19 +# github.com/googleapis/gax-go/v2 v2.12.5 +## explicit; go 1.20 github.com/googleapis/gax-go/v2 github.com/googleapis/gax-go/v2/apierror github.com/googleapis/gax-go/v2/apierror/internal/proto @@ -327,8 +327,8 @@ github.com/googleapis/gax-go/v2/internal # github.com/hashicorp/go-cleanhttp v0.5.2 ## explicit; go 1.13 github.com/hashicorp/go-cleanhttp -# github.com/hashicorp/go-retryablehttp v0.7.7 -## explicit; go 1.19 +# github.com/hashicorp/go-retryablehttp v0.7.4 +## explicit; go 1.13 github.com/hashicorp/go-retryablehttp # github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef ## explicit @@ -367,7 +367,7 @@ github.com/klauspost/cpuid/v2 ## explicit; go 1.11 github.com/kylelemons/godebug/diff github.com/kylelemons/godebug/pretty -# github.com/linode/linodego v1.36.0 +# github.com/linode/linodego v1.36.1 ## explicit; go 1.21 github.com/linode/linodego github.com/linode/linodego/internal/duration @@ -609,7 +609,7 @@ gomodules.xyz/wait gomodules.xyz/x/env gomodules.xyz/x/term gomodules.xyz/x/version -# google.golang.org/api v0.185.0 +# google.golang.org/api v0.187.0 ## explicit; go 1.20 google.golang.org/api/compute/v1 google.golang.org/api/googleapi @@ -623,7 +623,7 @@ google.golang.org/api/option google.golang.org/api/option/internaloption google.golang.org/api/transport/http google.golang.org/api/transport/http/internal/propagation -# google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d ## explicit; go 1.20 google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/errdetails @@ -731,7 +731,7 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/api v0.30.1 +# k8s.io/api v0.30.2 ## explicit; go 1.22.0 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 @@ -803,7 +803,7 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1 -# k8s.io/apimachinery v0.30.1 +# k8s.io/apimachinery v0.30.2 ## explicit; go 1.22.0 k8s.io/apimachinery/pkg/api/apitesting k8s.io/apimachinery/pkg/api/apitesting/fuzzer @@ -858,7 +858,7 @@ k8s.io/apimachinery/pkg/version k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/third_party/forked/golang/json k8s.io/apimachinery/third_party/forked/golang/reflect -# k8s.io/client-go v0.30.1 +# k8s.io/client-go v0.30.2 ## explicit; go 1.22.0 k8s.io/client-go/applyconfigurations/admissionregistration/v1 k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1 @@ -1030,7 +1030,7 @@ k8s.io/utils/pointer k8s.io/utils/ptr k8s.io/utils/strings/slices k8s.io/utils/trace -# kmodules.xyz/client-go v0.30.8 +# kmodules.xyz/client-go v0.30.9 ## explicit; go 1.22.0 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1 @@ -1047,7 +1047,7 @@ kmodules.xyz/go-containerregistry/name ## explicit; go 1.22.0 kmodules.xyz/offshoot-api/api/v1 kmodules.xyz/offshoot-api/api/v2 -# kmodules.xyz/resource-metadata v0.18.9 +# kmodules.xyz/resource-metadata v0.18.10 ## explicit; go 1.22.1 kmodules.xyz/resource-metadata/apis/meta kmodules.xyz/resource-metadata/apis/meta/v1alpha1