chore(deps): bump google.golang.org/api from 0.187.0 to 0.188.0 (#3255)

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.187.0 to 0.188.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.187.0...v0.188.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2024-07-22 10:34:43 -07:00 committed by GitHub
parent 8b8cc382a3
commit 6e88fbdc9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 621 additions and 337 deletions

14
go.mod
View File

@ -43,8 +43,8 @@ require github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
require (
cloud.google.com/go v0.115.0 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.8 // indirect
cloud.google.com/go/compute/metadata v0.4.0 // indirect
cloud.google.com/go/iam v1.1.10 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.29 // indirect
@ -130,15 +130,15 @@ require (
golang.org/x/sys v0.22.0
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.187.0
google.golang.org/genproto v0.0.0-20240624140628-dc46fd24d27d // indirect
google.golang.org/api v0.188.0
google.golang.org/genproto v0.0.0-20240708141625-4ad9e859172b // indirect
google.golang.org/grpc v1.64.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)
require (
cloud.google.com/go/auth v0.6.1 // indirect
cloud.google.com/go/auth v0.7.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
@ -188,8 +188,8 @@ require (
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.4.0 // indirect

33
go.sum
View File

@ -1,16 +1,16 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14=
cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU=
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 v0.7.0 h1:kf/x9B3WTbBUHkC+1VS8wwwli9TzhSt0vSTVBmMR8Ts=
cloud.google.com/go/auth v0.7.0/go.mod h1:D+WqdrpcjmiCgWrXmLLxOVq1GACoE36chW6KXoEvuIw=
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/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=
cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k=
cloud.google.com/go/iam v1.1.8 h1:r7umDwhj+BQyz0ScZMp4QrGXjSTI3ZINnpgU2nlB/K0=
cloud.google.com/go/iam v1.1.8/go.mod h1:GvE6lyMmfxXauzNq8NbgJbeVQNspG+tcdL/W8QO1+zE=
cloud.google.com/go/longrunning v0.5.7 h1:WLbHekDbjK1fVFD3ibpFFVoyizlLRl73I7YKuAKilhU=
cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng=
cloud.google.com/go/compute/metadata v0.4.0 h1:vHzJCWaM4g8XIcm8kopr3XmDA4Gy/lblD3EhhSux05c=
cloud.google.com/go/compute/metadata v0.4.0/go.mod h1:SIQh1Kkb4ZJ8zJ874fqVkslA29PRXuleyj6vOzlbK7M=
cloud.google.com/go/iam v1.1.10 h1:ZSAr64oEhQSClwBL670MsJAW5/RLiC6kfw3Bqmd5ZDI=
cloud.google.com/go/iam v1.1.10/go.mod h1:iEgMq62sg8zx446GCaijmA2Miwg5o3UbO+nI47WHJps=
cloud.google.com/go/longrunning v0.5.9 h1:haH9pAuXdPAMqHvzX0zlWQigXT7B0+CL4/2nXXdBo5k=
cloud.google.com/go/longrunning v0.5.9/go.mod h1:HD+0l9/OOW0za6UWdKJtXoFAX/BGg/3Wj8p10NeWF7c=
cloud.google.com/go/storage v1.42.0 h1:4QtGpplCVt1wz6g5o1ifXd656P5z+yNgzdw1tVfp0cU=
cloud.google.com/go/storage v1.42.0/go.mod h1:HjMXRFq65pGKFn6hxj6x3HCyR41uSB72Z0SO/Vn6JFQ=
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
@ -596,6 +596,7 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@ -635,19 +636,19 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
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/api v0.188.0 h1:51y8fJ/b1AaaBRJr4yWm96fPcuxSo0JcegXE3DaHQHw=
google.golang.org/api v0.188.0/go.mod h1:VR0d+2SIiWOYG3r/jdm7adPW9hI2aRv9ETOSCQ9Beag=
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/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20240624140628-dc46fd24d27d h1:PksQg4dV6Sem3/HkBX+Ltq8T0ke0PKIRBNBatoDTVls=
google.golang.org/genproto v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:s7iA721uChleev562UJO2OYB0PPT9CMFjV+Ce7VJH5M=
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 h1:MuYw1wJzT+ZkybKfaOXKp5hJiZDn2iHaXRw0mRYdHSc=
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4/go.mod h1:px9SlOOZBg1wM1zdnr8jEL4CNGUBZ+ZKYtNPApNQc4c=
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/genproto v0.0.0-20240708141625-4ad9e859172b h1:dSTjko30weBaMj3eERKc0ZVXW4GudCswM3m+P++ukU0=
google.golang.org/genproto v0.0.0-20240708141625-4ad9e859172b/go.mod h1:FfBgJBJg9GcpPvKIuHSZ/aE1g2ecGL74upMzGZjiGEY=
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0=
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b h1:04+jVzTs2XBnOZcPsLnmrTGqltqJbZQ1Ey26hjYdQQ0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=

View File

@ -1,5 +1,19 @@
# Changelog
## [0.7.0](https://github.com/googleapis/google-cloud-go/compare/auth/v0.6.1...auth/v0.7.0) (2024-07-09)
### Features
* **auth:** Add workload X509 cert provider as a default cert provider ([#10479](https://github.com/googleapis/google-cloud-go/issues/10479)) ([c51ee6c](https://github.com/googleapis/google-cloud-go/commit/c51ee6cf65ce05b4d501083e49d468c75ac1ea63))
### Bug Fixes
* **auth/oauth2adapt:** Bump google.golang.org/api@v0.187.0 ([8fa9e39](https://github.com/googleapis/google-cloud-go/commit/8fa9e398e512fd8533fd49060371e61b5725a85b))
* **auth:** Bump google.golang.org/api@v0.187.0 ([8fa9e39](https://github.com/googleapis/google-cloud-go/commit/8fa9e398e512fd8533fd49060371e61b5725a85b))
* **auth:** Check len of slices, not non-nil ([#10483](https://github.com/googleapis/google-cloud-go/issues/10483)) ([0a966a1](https://github.com/googleapis/google-cloud-go/commit/0a966a183e5f0e811977216d736d875b7233e942))
## [0.6.1](https://github.com/googleapis/google-cloud-go/compare/auth/v0.6.0...auth/v0.6.1) (2024-07-01)

View File

@ -538,12 +538,12 @@ func (tp tokenProvider2LO) Token(ctx context.Context) (*Token, error) {
v := url.Values{}
v.Set("grant_type", defaultGrantType)
v.Set("assertion", payload)
resp, err := tp.Client.PostForm(tp.opts.TokenURL, v)
req, err := http.NewRequestWithContext(ctx, "POST", tp.opts.TokenURL, strings.NewReader(v.Encode()))
if err != nil {
return nil, fmt.Errorf("auth: cannot fetch token: %w", err)
return nil, err
}
defer resp.Body.Close()
body, err := internal.ReadAll(resp.Body)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, body, err := internal.DoRequest(tp.Client, req)
if err != nil {
return nil, fmt.Errorf("auth: cannot fetch token: %w", err)
}

View File

@ -76,7 +76,7 @@ func DetectDefault(opts *DetectOptions) (*auth.Credentials, error) {
if err := opts.validate(); err != nil {
return nil, err
}
if opts.CredentialsJSON != nil {
if len(opts.CredentialsJSON) > 0 {
return readCredentialsFileJSON(opts.CredentialsJSON, opts)
}
if opts.CredentialsFile != "" {

View File

@ -122,7 +122,7 @@ func (sp *awsSubjectProvider) subjectToken(ctx context.Context) (string, error)
// Generate the signed request to AWS STS GetCallerIdentity API.
// Use the required regional endpoint. Otherwise, the request will fail.
req, err := http.NewRequest("POST", strings.Replace(sp.RegionalCredVerificationURL, "{region}", sp.region, 1), nil)
req, err := http.NewRequestWithContext(ctx, "POST", strings.Replace(sp.RegionalCredVerificationURL, "{region}", sp.region, 1), nil)
if err != nil {
return "", err
}
@ -194,20 +194,14 @@ func (sp *awsSubjectProvider) getAWSSessionToken(ctx context.Context) (string, e
}
req.Header.Set(awsIMDSv2SessionTTLHeader, awsIMDSv2SessionTTL)
resp, err := sp.Client.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
respBody, err := internal.ReadAll(resp.Body)
resp, body, err := internal.DoRequest(sp.Client, req)
if err != nil {
return "", err
}
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("credentials: unable to retrieve AWS session token: %s", respBody)
return "", fmt.Errorf("credentials: unable to retrieve AWS session token: %s", body)
}
return string(respBody), nil
return string(body), nil
}
func (sp *awsSubjectProvider) getRegion(ctx context.Context, headers map[string]string) (string, error) {
@ -233,29 +227,21 @@ func (sp *awsSubjectProvider) getRegion(ctx context.Context, headers map[string]
for name, value := range headers {
req.Header.Add(name, value)
}
resp, err := sp.Client.Do(req)
resp, body, err := internal.DoRequest(sp.Client, req)
if err != nil {
return "", err
}
defer resp.Body.Close()
respBody, err := internal.ReadAll(resp.Body)
if err != nil {
return "", err
}
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("credentials: unable to retrieve AWS region - %s", respBody)
return "", fmt.Errorf("credentials: unable to retrieve AWS region - %s", body)
}
// This endpoint will return the region in format: us-east-2b.
// Only the us-east-2 part should be used.
bodyLen := len(respBody)
bodyLen := len(body)
if bodyLen == 0 {
return "", nil
}
return string(respBody[:bodyLen-1]), nil
return string(body[:bodyLen-1]), nil
}
func (sp *awsSubjectProvider) getSecurityCredentials(ctx context.Context, headers map[string]string) (result *AwsSecurityCredentials, err error) {
@ -299,22 +285,17 @@ func (sp *awsSubjectProvider) getMetadataSecurityCredentials(ctx context.Context
for name, value := range headers {
req.Header.Add(name, value)
}
resp, err := sp.Client.Do(req)
if err != nil {
return result, err
}
defer resp.Body.Close()
respBody, err := internal.ReadAll(resp.Body)
resp, body, err := internal.DoRequest(sp.Client, req)
if err != nil {
return result, err
}
if resp.StatusCode != http.StatusOK {
return result, fmt.Errorf("credentials: unable to retrieve AWS security credentials - %s", respBody)
return result, fmt.Errorf("credentials: unable to retrieve AWS security credentials - %s", body)
}
err = json.Unmarshal(respBody, &result)
return result, err
if err := json.Unmarshal(body, &result); err != nil {
return nil, err
}
return result, nil
}
func (sp *awsSubjectProvider) getMetadataRoleName(ctx context.Context, headers map[string]string) (string, error) {
@ -329,20 +310,14 @@ func (sp *awsSubjectProvider) getMetadataRoleName(ctx context.Context, headers m
req.Header.Add(name, value)
}
resp, err := sp.Client.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
respBody, err := internal.ReadAll(resp.Body)
resp, body, err := internal.DoRequest(sp.Client, req)
if err != nil {
return "", err
}
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("credentials: unable to retrieve AWS role name - %s", respBody)
return "", fmt.Errorf("credentials: unable to retrieve AWS role name - %s", body)
}
return string(respBody), nil
return string(body), nil
}
// awsRequestSigner is a utility class to sign http requests using a AWS V4 signature.

View File

@ -48,27 +48,21 @@ func (sp *urlSubjectProvider) subjectToken(ctx context.Context) (string, error)
for key, val := range sp.Headers {
req.Header.Add(key, val)
}
resp, err := sp.Client.Do(req)
resp, body, err := internal.DoRequest(sp.Client, req)
if err != nil {
return "", fmt.Errorf("credentials: invalid response when retrieving subject token: %w", err)
}
defer resp.Body.Close()
respBody, err := internal.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("credentials: invalid body in subject token URL query: %w", err)
}
if c := resp.StatusCode; c < http.StatusOK || c >= http.StatusMultipleChoices {
return "", fmt.Errorf("credentials: status code %d: %s", c, respBody)
return "", fmt.Errorf("credentials: status code %d: %s", c, body)
}
if sp.Format == nil {
return string(respBody), nil
return string(body), nil
}
switch sp.Format.Type {
case "json":
jsonData := make(map[string]interface{})
err = json.Unmarshal(respBody, &jsonData)
err = json.Unmarshal(body, &jsonData)
if err != nil {
return "", fmt.Errorf("credentials: failed to unmarshal subject token file: %w", err)
}
@ -82,7 +76,7 @@ func (sp *urlSubjectProvider) subjectToken(ctx context.Context) (string, error)
}
return token, nil
case fileTypeText:
return string(respBody), nil
return string(body), nil
default:
return "", errors.New("credentials: invalid credential_source file format type: " + sp.Format.Type)
}

View File

@ -25,6 +25,7 @@ import (
"net/http"
"net/url"
"os"
"strings"
"time"
"cloud.google.com/go/auth"
@ -129,12 +130,13 @@ func (g gdchProvider) Token(ctx context.Context) (*auth.Token, error) {
v.Set("requested_token_type", requestTokenType)
v.Set("subject_token", payload)
v.Set("subject_token_type", subjectTokenType)
resp, err := g.client.PostForm(g.tokenURL, v)
req, err := http.NewRequestWithContext(ctx, "POST", g.tokenURL, strings.NewReader(v.Encode()))
if err != nil {
return nil, fmt.Errorf("credentials: cannot fetch token: %w", err)
return nil, err
}
defer resp.Body.Close()
body, err := internal.ReadAll(resp.Body)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, body, err := internal.DoRequest(g.client, req)
if err != nil {
return nil, fmt.Errorf("credentials: cannot fetch token: %w", err)
}

View File

@ -109,15 +109,10 @@ func (o *Options) Token(ctx context.Context) (*auth.Token, error) {
if err := setAuthHeader(ctx, o.Tp, req); err != nil {
return nil, err
}
resp, err := o.Client.Do(req)
resp, body, err := internal.DoRequest(o.Client, req)
if err != nil {
return nil, fmt.Errorf("credentials: unable to generate access token: %w", err)
}
defer resp.Body.Close()
body, err := internal.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("credentials: unable to read body: %w", err)
}
if c := resp.StatusCode; c < http.StatusOK || c >= http.StatusMultipleChoices {
return nil, fmt.Errorf("credentials: status code %d: %s", c, body)
}

View File

@ -93,16 +93,10 @@ func doRequest(ctx context.Context, opts *Options, data url.Values) (*TokenRespo
}
req.Header.Set("Content-Length", strconv.Itoa(len(encodedData)))
resp, err := opts.Client.Do(req)
resp, body, err := internal.DoRequest(opts.Client, req)
if err != nil {
return nil, fmt.Errorf("credentials: invalid response from Secure Token Server: %w", err)
}
defer resp.Body.Close()
body, err := internal.ReadAll(resp.Body)
if err != nil {
return nil, err
}
if c := resp.StatusCode; c < http.StatusOK || c > http.StatusMultipleChoices {
return nil, fmt.Errorf("credentials: status code %d: %s", c, body)
}

View File

@ -124,6 +124,21 @@ func GetProjectID(b []byte, override string) string {
return v.Project
}
// DoRequest executes the provided req with the client. It reads the response
// body, closes it, and returns it.
func DoRequest(client *http.Client, req *http.Request) (*http.Response, []byte, error) {
resp, err := client.Do(req)
if err != nil {
return nil, nil, err
}
defer resp.Body.Close()
body, err := ReadAll(io.LimitReader(resp.Body, maxBodySize))
if err != nil {
return nil, nil, err
}
return resp, body, nil
}
// ReadAll consumes the whole reader and safely reads the content of its body
// with some overflow protection.
func ReadAll(r io.Reader) ([]byte, error) {
@ -167,8 +182,7 @@ func (c *ComputeUniverseDomainProvider) GetProperty(ctx context.Context) (string
// httpGetMetadataUniverseDomain is a package var for unit test substitution.
var httpGetMetadataUniverseDomain = func(ctx context.Context) (string, error) {
client := metadata.NewClient(&http.Client{Timeout: time.Second})
// TODO(quartzmo): set ctx on request
return client.Get("universe/universe_domain")
return client.GetWithContext(ctx, "universe/universe_domain")
}
func getMetadataUniverseDomain(ctx context.Context) (string, error) {

View File

@ -50,11 +50,14 @@ var errSourceUnavailable = errors.New("certificate source is unavailable")
// returned to indicate that a default certificate source is unavailable.
func DefaultProvider() (Provider, error) {
defaultCert.once.Do(func() {
defaultCert.provider, defaultCert.err = NewEnterpriseCertificateProxyProvider("")
defaultCert.provider, defaultCert.err = NewWorkloadX509CertProvider("")
if errors.Is(defaultCert.err, errSourceUnavailable) {
defaultCert.provider, defaultCert.err = NewSecureConnectProvider("")
defaultCert.provider, defaultCert.err = NewEnterpriseCertificateProxyProvider("")
if errors.Is(defaultCert.err, errSourceUnavailable) {
defaultCert.provider, defaultCert.err = nil, nil
defaultCert.provider, defaultCert.err = NewSecureConnectProvider("")
if errors.Is(defaultCert.err, errSourceUnavailable) {
defaultCert.provider, defaultCert.err = nil, nil
}
}
}
})

View File

@ -99,7 +99,7 @@ func getCertAndKeyFiles(configFilePath string) (string, string, error) {
}
if config.CertConfigs.Workload == nil {
return "", "", errors.New("no Workload Identity Federation certificate information found in the certificate configuration file")
return "", "", errSourceUnavailable
}
certFile := config.CertConfigs.Workload.CertPath

View File

@ -53,11 +53,11 @@ func CloneDetectOptions(oldDo *credentials.DetectOptions) *credentials.DetectOpt
}
// Smartly size this memory and copy below.
if oldDo.CredentialsJSON != nil {
if len(oldDo.CredentialsJSON) > 0 {
newDo.CredentialsJSON = make([]byte, len(oldDo.CredentialsJSON))
copy(newDo.CredentialsJSON, oldDo.CredentialsJSON)
}
if oldDo.Scopes != nil {
if len(oldDo.Scopes) > 0 {
newDo.Scopes = make([]string, len(oldDo.Scopes))
copy(newDo.Scopes, oldDo.Scopes)
}

View File

@ -285,7 +285,7 @@ func fetchToken(ctx context.Context, o *Options3LO, v url.Values) (*Token, strin
v.Set("client_secret", o.ClientSecret)
}
}
req, err := http.NewRequest("POST", o.TokenURL, strings.NewReader(v.Encode()))
req, err := http.NewRequestWithContext(ctx, "POST", o.TokenURL, strings.NewReader(v.Encode()))
if err != nil {
return nil, refreshToken, err
}
@ -295,25 +295,19 @@ func fetchToken(ctx context.Context, o *Options3LO, v url.Values) (*Token, strin
}
// Make request
r, err := o.client().Do(req.WithContext(ctx))
resp, body, err := internal.DoRequest(o.client(), req)
if err != nil {
return nil, refreshToken, err
}
body, err := internal.ReadAll(r.Body)
r.Body.Close()
if err != nil {
return nil, refreshToken, fmt.Errorf("auth: cannot fetch token: %w", err)
}
failureStatus := r.StatusCode < 200 || r.StatusCode > 299
failureStatus := resp.StatusCode < 200 || resp.StatusCode > 299
tokError := &Error{
Response: r,
Response: resp,
Body: body,
}
var token *Token
// errors ignored because of default switch on content
content, _, _ := mime.ParseMediaType(r.Header.Get("Content-Type"))
content, _, _ := mime.ParseMediaType(resp.Header.Get("Content-Type"))
switch content {
case "application/x-www-form-urlencoded", "text/plain":
// some endpoints return a query string

View File

@ -1,5 +1,17 @@
# Changes
## [0.4.0](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.3.0...compute/metadata/v0.4.0) (2024-07-01)
### Features
* **compute/metadata:** Add context for all functions/methods ([#10370](https://github.com/googleapis/google-cloud-go/issues/10370)) ([66b8efe](https://github.com/googleapis/google-cloud-go/commit/66b8efe7ad877e052b2987bb4475477e38c67bb3))
### Documentation
* **compute/metadata:** Update OnGCE description ([#10408](https://github.com/googleapis/google-cloud-go/issues/10408)) ([6a46dca](https://github.com/googleapis/google-cloud-go/commit/6a46dca4eae4f88ec6f88822e01e5bf8aeca787f))
## [0.3.0](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.2.3...compute/metadata/v0.3.0) (2024-04-15)

View File

@ -88,16 +88,16 @@ func (suffix NotDefinedError) Error() string {
return fmt.Sprintf("metadata: GCE metadata %q not defined", string(suffix))
}
func (c *cachedValue) get(cl *Client) (v string, err error) {
func (c *cachedValue) get(ctx context.Context, cl *Client) (v string, err error) {
defer c.mu.Unlock()
c.mu.Lock()
if c.v != "" {
return c.v, nil
}
if c.trim {
v, err = cl.getTrimmed(context.Background(), c.k)
v, err = cl.getTrimmed(ctx, c.k)
} else {
v, err = cl.GetWithContext(context.Background(), c.k)
v, err = cl.GetWithContext(ctx, c.k)
}
if err == nil {
c.v = v
@ -110,7 +110,9 @@ var (
onGCE bool
)
// OnGCE reports whether this process is running on Google Compute Engine.
// OnGCE reports whether this process is running on Google Compute Platforms.
// NOTE: True returned from `OnGCE` does not guarantee that the metadata server
// is accessible from this process and have all the metadata defined.
func OnGCE() bool {
onGCEOnce.Do(initOnGCE)
return onGCE
@ -203,6 +205,8 @@ func systemInfoSuggestsGCE() bool {
}
// Subscribe calls Client.SubscribeWithContext on the default client.
//
// Deprecated: Please use the context aware variant [SubscribeWithContext].
func Subscribe(suffix string, fn func(v string, ok bool) error) error {
return defaultClient.SubscribeWithContext(context.Background(), suffix, func(ctx context.Context, v string, ok bool) error { return fn(v, ok) })
}
@ -225,55 +229,188 @@ func GetWithContext(ctx context.Context, suffix string) (string, error) {
}
// ProjectID returns the current instance's project ID string.
func ProjectID() (string, error) { return defaultClient.ProjectID() }
//
// Deprecated: Please use the context aware variant [ProjectIDWithContext].
func ProjectID() (string, error) {
return defaultClient.ProjectIDWithContext(context.Background())
}
// ProjectIDWithContext returns the current instance's project ID string.
func ProjectIDWithContext(ctx context.Context) (string, error) {
return defaultClient.ProjectIDWithContext(ctx)
}
// NumericProjectID returns the current instance's numeric project ID.
func NumericProjectID() (string, error) { return defaultClient.NumericProjectID() }
//
// Deprecated: Please use the context aware variant [NumericProjectIDWithContext].
func NumericProjectID() (string, error) {
return defaultClient.NumericProjectIDWithContext(context.Background())
}
// NumericProjectIDWithContext returns the current instance's numeric project ID.
func NumericProjectIDWithContext(ctx context.Context) (string, error) {
return defaultClient.NumericProjectIDWithContext(ctx)
}
// InternalIP returns the instance's primary internal IP address.
func InternalIP() (string, error) { return defaultClient.InternalIP() }
//
// Deprecated: Please use the context aware variant [InternalIPWithContext].
func InternalIP() (string, error) {
return defaultClient.InternalIPWithContext(context.Background())
}
// InternalIPWithContext returns the instance's primary internal IP address.
func InternalIPWithContext(ctx context.Context) (string, error) {
return defaultClient.InternalIPWithContext(ctx)
}
// ExternalIP returns the instance's primary external (public) IP address.
func ExternalIP() (string, error) { return defaultClient.ExternalIP() }
//
// Deprecated: Please use the context aware variant [ExternalIPWithContext].
func ExternalIP() (string, error) {
return defaultClient.ExternalIPWithContext(context.Background())
}
// Email calls Client.Email on the default client.
func Email(serviceAccount string) (string, error) { return defaultClient.Email(serviceAccount) }
// ExternalIPWithContext returns the instance's primary external (public) IP address.
func ExternalIPWithContext(ctx context.Context) (string, error) {
return defaultClient.ExternalIPWithContext(ctx)
}
// Email calls Client.EmailWithContext on the default client.
//
// Deprecated: Please use the context aware variant [EmailWithContext].
func Email(serviceAccount string) (string, error) {
return defaultClient.EmailWithContext(context.Background(), serviceAccount)
}
// EmailWithContext calls Client.EmailWithContext on the default client.
func EmailWithContext(ctx context.Context, serviceAccount string) (string, error) {
return defaultClient.EmailWithContext(ctx, serviceAccount)
}
// Hostname returns the instance's hostname. This will be of the form
// "<instanceID>.c.<projID>.internal".
func Hostname() (string, error) { return defaultClient.Hostname() }
//
// Deprecated: Please use the context aware variant [HostnameWithContext].
func Hostname() (string, error) {
return defaultClient.HostnameWithContext(context.Background())
}
// HostnameWithContext returns the instance's hostname. This will be of the form
// "<instanceID>.c.<projID>.internal".
func HostnameWithContext(ctx context.Context) (string, error) {
return defaultClient.HostnameWithContext(ctx)
}
// InstanceTags returns the list of user-defined instance tags,
// assigned when initially creating a GCE instance.
func InstanceTags() ([]string, error) { return defaultClient.InstanceTags() }
//
// Deprecated: Please use the context aware variant [InstanceTagsWithContext].
func InstanceTags() ([]string, error) {
return defaultClient.InstanceTagsWithContext(context.Background())
}
// InstanceTagsWithContext returns the list of user-defined instance tags,
// assigned when initially creating a GCE instance.
func InstanceTagsWithContext(ctx context.Context) ([]string, error) {
return defaultClient.InstanceTagsWithContext(ctx)
}
// InstanceID returns the current VM's numeric instance ID.
func InstanceID() (string, error) { return defaultClient.InstanceID() }
//
// Deprecated: Please use the context aware variant [InstanceIDWithContext].
func InstanceID() (string, error) {
return defaultClient.InstanceIDWithContext(context.Background())
}
// InstanceIDWithContext returns the current VM's numeric instance ID.
func InstanceIDWithContext(ctx context.Context) (string, error) {
return defaultClient.InstanceIDWithContext(ctx)
}
// InstanceName returns the current VM's instance ID string.
func InstanceName() (string, error) { return defaultClient.InstanceName() }
//
// Deprecated: Please use the context aware variant [InstanceNameWithContext].
func InstanceName() (string, error) {
return defaultClient.InstanceNameWithContext(context.Background())
}
// InstanceNameWithContext returns the current VM's instance ID string.
func InstanceNameWithContext(ctx context.Context) (string, error) {
return defaultClient.InstanceNameWithContext(ctx)
}
// Zone returns the current VM's zone, such as "us-central1-b".
func Zone() (string, error) { return defaultClient.Zone() }
//
// Deprecated: Please use the context aware variant [ZoneWithContext].
func Zone() (string, error) {
return defaultClient.ZoneWithContext(context.Background())
}
// InstanceAttributes calls Client.InstanceAttributes on the default client.
func InstanceAttributes() ([]string, error) { return defaultClient.InstanceAttributes() }
// ZoneWithContext returns the current VM's zone, such as "us-central1-b".
func ZoneWithContext(ctx context.Context) (string, error) {
return defaultClient.ZoneWithContext(ctx)
}
// ProjectAttributes calls Client.ProjectAttributes on the default client.
func ProjectAttributes() ([]string, error) { return defaultClient.ProjectAttributes() }
// InstanceAttributes calls Client.InstanceAttributesWithContext on the default client.
//
// Deprecated: Please use the context aware variant [InstanceAttributesWithContext.
func InstanceAttributes() ([]string, error) {
return defaultClient.InstanceAttributesWithContext(context.Background())
}
// InstanceAttributeValue calls Client.InstanceAttributeValue on the default client.
// InstanceAttributesWithContext calls Client.ProjectAttributesWithContext on the default client.
func InstanceAttributesWithContext(ctx context.Context) ([]string, error) {
return defaultClient.InstanceAttributesWithContext(ctx)
}
// ProjectAttributes calls Client.ProjectAttributesWithContext on the default client.
//
// Deprecated: Please use the context aware variant [ProjectAttributesWithContext].
func ProjectAttributes() ([]string, error) {
return defaultClient.ProjectAttributesWithContext(context.Background())
}
// ProjectAttributesWithContext calls Client.ProjectAttributesWithContext on the default client.
func ProjectAttributesWithContext(ctx context.Context) ([]string, error) {
return defaultClient.ProjectAttributesWithContext(ctx)
}
// InstanceAttributeValue calls Client.InstanceAttributeValueWithContext on the default client.
//
// Deprecated: Please use the context aware variant [InstanceAttributeValueWithContext].
func InstanceAttributeValue(attr string) (string, error) {
return defaultClient.InstanceAttributeValue(attr)
return defaultClient.InstanceAttributeValueWithContext(context.Background(), attr)
}
// ProjectAttributeValue calls Client.ProjectAttributeValue on the default client.
// InstanceAttributeValueWithContext calls Client.InstanceAttributeValueWithContext on the default client.
func InstanceAttributeValueWithContext(ctx context.Context, attr string) (string, error) {
return defaultClient.InstanceAttributeValueWithContext(ctx, attr)
}
// ProjectAttributeValue calls Client.ProjectAttributeValueWithContext on the default client.
//
// Deprecated: Please use the context aware variant [ProjectAttributeValueWithContext].
func ProjectAttributeValue(attr string) (string, error) {
return defaultClient.ProjectAttributeValue(attr)
return defaultClient.ProjectAttributeValueWithContext(context.Background(), attr)
}
// Scopes calls Client.Scopes on the default client.
func Scopes(serviceAccount string) ([]string, error) { return defaultClient.Scopes(serviceAccount) }
// ProjectAttributeValueWithContext calls Client.ProjectAttributeValueWithContext on the default client.
func ProjectAttributeValueWithContext(ctx context.Context, attr string) (string, error) {
return defaultClient.ProjectAttributeValueWithContext(ctx, attr)
}
// Scopes calls Client.ScopesWithContext on the default client.
//
// Deprecated: Please use the context aware variant [ScopesWithContext].
func Scopes(serviceAccount string) ([]string, error) {
return defaultClient.ScopesWithContext(context.Background(), serviceAccount)
}
// ScopesWithContext calls Client.ScopesWithContext on the default client.
func ScopesWithContext(ctx context.Context, serviceAccount string) ([]string, error) {
return defaultClient.ScopesWithContext(ctx, serviceAccount)
}
func strsContains(ss []string, s string) bool {
for _, v := range ss {
@ -296,7 +433,6 @@ func NewClient(c *http.Client) *Client {
if c == nil {
return defaultClient
}
return &Client{hc: c}
}
@ -381,6 +517,10 @@ func (c *Client) Get(suffix string) (string, error) {
//
// If the requested metadata is not defined, the returned error will
// be of type NotDefinedError.
//
// NOTE: Without an extra deadline in the context this call can take in the
// worst case, with internal backoff retries, up to 15 seconds (e.g. when server
// is responding slowly). Pass context with additional timeouts when needed.
func (c *Client) GetWithContext(ctx context.Context, suffix string) (string, error) {
val, _, err := c.getETag(ctx, suffix)
return val, err
@ -392,8 +532,8 @@ func (c *Client) getTrimmed(ctx context.Context, suffix string) (s string, err e
return
}
func (c *Client) lines(suffix string) ([]string, error) {
j, err := c.GetWithContext(context.Background(), suffix)
func (c *Client) lines(ctx context.Context, suffix string) ([]string, error) {
j, err := c.GetWithContext(ctx, suffix)
if err != nil {
return nil, err
}
@ -405,45 +545,104 @@ func (c *Client) lines(suffix string) ([]string, error) {
}
// ProjectID returns the current instance's project ID string.
func (c *Client) ProjectID() (string, error) { return projID.get(c) }
//
// Deprecated: Please use the context aware variant [Client.ProjectIDWithContext].
func (c *Client) ProjectID() (string, error) { return c.ProjectIDWithContext(context.Background()) }
// ProjectIDWithContext returns the current instance's project ID string.
func (c *Client) ProjectIDWithContext(ctx context.Context) (string, error) { return projID.get(ctx, c) }
// NumericProjectID returns the current instance's numeric project ID.
func (c *Client) NumericProjectID() (string, error) { return projNum.get(c) }
//
// Deprecated: Please use the context aware variant [Client.NumericProjectIDWithContext].
func (c *Client) NumericProjectID() (string, error) {
return c.NumericProjectIDWithContext(context.Background())
}
// NumericProjectIDWithContext returns the current instance's numeric project ID.
func (c *Client) NumericProjectIDWithContext(ctx context.Context) (string, error) {
return projNum.get(ctx, c)
}
// InstanceID returns the current VM's numeric instance ID.
func (c *Client) InstanceID() (string, error) { return instID.get(c) }
//
// Deprecated: Please use the context aware variant [Client.InstanceIDWithContext].
func (c *Client) InstanceID() (string, error) {
return c.InstanceIDWithContext(context.Background())
}
// InstanceIDWithContext returns the current VM's numeric instance ID.
func (c *Client) InstanceIDWithContext(ctx context.Context) (string, error) {
return instID.get(ctx, c)
}
// InternalIP returns the instance's primary internal IP address.
//
// Deprecated: Please use the context aware variant [Client.InternalIPWithContext].
func (c *Client) InternalIP() (string, error) {
return c.getTrimmed(context.Background(), "instance/network-interfaces/0/ip")
return c.InternalIPWithContext(context.Background())
}
// InternalIPWithContext returns the instance's primary internal IP address.
func (c *Client) InternalIPWithContext(ctx context.Context) (string, error) {
return c.getTrimmed(ctx, "instance/network-interfaces/0/ip")
}
// Email returns the email address associated with the service account.
// The account may be empty or the string "default" to use the instance's
// main account.
//
// Deprecated: Please use the context aware variant [Client.EmailWithContext].
func (c *Client) Email(serviceAccount string) (string, error) {
return c.EmailWithContext(context.Background(), serviceAccount)
}
// EmailWithContext returns the email address associated with the service account.
// The serviceAccount parameter default value (empty string or "default" value)
// will use the instance's main account.
func (c *Client) EmailWithContext(ctx context.Context, serviceAccount string) (string, error) {
if serviceAccount == "" {
serviceAccount = "default"
}
return c.getTrimmed(context.Background(), "instance/service-accounts/"+serviceAccount+"/email")
return c.getTrimmed(ctx, "instance/service-accounts/"+serviceAccount+"/email")
}
// ExternalIP returns the instance's primary external (public) IP address.
//
// Deprecated: Please use the context aware variant [Client.ExternalIPWithContext].
func (c *Client) ExternalIP() (string, error) {
return c.getTrimmed(context.Background(), "instance/network-interfaces/0/access-configs/0/external-ip")
return c.ExternalIPWithContext(context.Background())
}
// ExternalIPWithContext returns the instance's primary external (public) IP address.
func (c *Client) ExternalIPWithContext(ctx context.Context) (string, error) {
return c.getTrimmed(ctx, "instance/network-interfaces/0/access-configs/0/external-ip")
}
// Hostname returns the instance's hostname. This will be of the form
// "<instanceID>.c.<projID>.internal".
//
// Deprecated: Please use the context aware variant [Client.HostnameWithContext].
func (c *Client) Hostname() (string, error) {
return c.getTrimmed(context.Background(), "instance/hostname")
return c.HostnameWithContext(context.Background())
}
// InstanceTags returns the list of user-defined instance tags,
// assigned when initially creating a GCE instance.
// HostnameWithContext returns the instance's hostname. This will be of the form
// "<instanceID>.c.<projID>.internal".
func (c *Client) HostnameWithContext(ctx context.Context) (string, error) {
return c.getTrimmed(ctx, "instance/hostname")
}
// InstanceTags returns the list of user-defined instance tags.
//
// Deprecated: Please use the context aware variant [Client.InstanceTagsWithContext].
func (c *Client) InstanceTags() ([]string, error) {
return c.InstanceTagsWithContext(context.Background())
}
// InstanceTagsWithContext returns the list of user-defined instance tags,
// assigned when initially creating a GCE instance.
func (c *Client) InstanceTagsWithContext(ctx context.Context) ([]string, error) {
var s []string
j, err := c.GetWithContext(context.Background(), "instance/tags")
j, err := c.GetWithContext(ctx, "instance/tags")
if err != nil {
return nil, err
}
@ -454,13 +653,27 @@ func (c *Client) InstanceTags() ([]string, error) {
}
// InstanceName returns the current VM's instance ID string.
//
// Deprecated: Please use the context aware variant [Client.InstanceNameWithContext].
func (c *Client) InstanceName() (string, error) {
return c.getTrimmed(context.Background(), "instance/name")
return c.InstanceNameWithContext(context.Background())
}
// InstanceNameWithContext returns the current VM's instance ID string.
func (c *Client) InstanceNameWithContext(ctx context.Context) (string, error) {
return c.getTrimmed(ctx, "instance/name")
}
// Zone returns the current VM's zone, such as "us-central1-b".
//
// Deprecated: Please use the context aware variant [Client.ZoneWithContext].
func (c *Client) Zone() (string, error) {
zone, err := c.getTrimmed(context.Background(), "instance/zone")
return c.ZoneWithContext(context.Background())
}
// ZoneWithContext returns the current VM's zone, such as "us-central1-b".
func (c *Client) ZoneWithContext(ctx context.Context) (string, error) {
zone, err := c.getTrimmed(ctx, "instance/zone")
// zone is of the form "projects/<projNum>/zones/<zoneName>".
if err != nil {
return "", err
@ -471,12 +684,34 @@ func (c *Client) Zone() (string, error) {
// InstanceAttributes returns the list of user-defined attributes,
// assigned when initially creating a GCE VM instance. The value of an
// attribute can be obtained with InstanceAttributeValue.
func (c *Client) InstanceAttributes() ([]string, error) { return c.lines("instance/attributes/") }
//
// Deprecated: Please use the context aware variant [Client.InstanceAttributesWithContext].
func (c *Client) InstanceAttributes() ([]string, error) {
return c.InstanceAttributesWithContext(context.Background())
}
// InstanceAttributesWithContext returns the list of user-defined attributes,
// assigned when initially creating a GCE VM instance. The value of an
// attribute can be obtained with InstanceAttributeValue.
func (c *Client) InstanceAttributesWithContext(ctx context.Context) ([]string, error) {
return c.lines(ctx, "instance/attributes/")
}
// ProjectAttributes returns the list of user-defined attributes
// applying to the project as a whole, not just this VM. The value of
// an attribute can be obtained with ProjectAttributeValue.
func (c *Client) ProjectAttributes() ([]string, error) { return c.lines("project/attributes/") }
//
// Deprecated: Please use the context aware variant [Client.ProjectAttributesWithContext].
func (c *Client) ProjectAttributes() ([]string, error) {
return c.ProjectAttributesWithContext(context.Background())
}
// ProjectAttributesWithContext returns the list of user-defined attributes
// applying to the project as a whole, not just this VM. The value of
// an attribute can be obtained with ProjectAttributeValue.
func (c *Client) ProjectAttributesWithContext(ctx context.Context) ([]string, error) {
return c.lines(ctx, "project/attributes/")
}
// InstanceAttributeValue returns the value of the provided VM
// instance attribute.
@ -486,8 +721,22 @@ func (c *Client) ProjectAttributes() ([]string, error) { return c.lines("project
//
// InstanceAttributeValue may return ("", nil) if the attribute was
// defined to be the empty string.
//
// Deprecated: Please use the context aware variant [Client.InstanceAttributeValueWithContext].
func (c *Client) InstanceAttributeValue(attr string) (string, error) {
return c.GetWithContext(context.Background(), "instance/attributes/"+attr)
return c.InstanceAttributeValueWithContext(context.Background(), attr)
}
// InstanceAttributeValueWithContext returns the value of the provided VM
// instance attribute.
//
// If the requested attribute is not defined, the returned error will
// be of type NotDefinedError.
//
// InstanceAttributeValue may return ("", nil) if the attribute was
// defined to be the empty string.
func (c *Client) InstanceAttributeValueWithContext(ctx context.Context, attr string) (string, error) {
return c.GetWithContext(ctx, "instance/attributes/"+attr)
}
// ProjectAttributeValue returns the value of the provided
@ -498,18 +747,41 @@ func (c *Client) InstanceAttributeValue(attr string) (string, error) {
//
// ProjectAttributeValue may return ("", nil) if the attribute was
// defined to be the empty string.
//
// Deprecated: Please use the context aware variant [Client.ProjectAttributeValueWithContext].
func (c *Client) ProjectAttributeValue(attr string) (string, error) {
return c.GetWithContext(context.Background(), "project/attributes/"+attr)
return c.ProjectAttributeValueWithContext(context.Background(), attr)
}
// ProjectAttributeValueWithContext returns the value of the provided
// project attribute.
//
// If the requested attribute is not defined, the returned error will
// be of type NotDefinedError.
//
// ProjectAttributeValue may return ("", nil) if the attribute was
// defined to be the empty string.
func (c *Client) ProjectAttributeValueWithContext(ctx context.Context, attr string) (string, error) {
return c.GetWithContext(ctx, "project/attributes/"+attr)
}
// Scopes returns the service account scopes for the given account.
// The account may be empty or the string "default" to use the instance's
// main account.
//
// Deprecated: Please use the context aware variant [Client.ScopesWithContext].
func (c *Client) Scopes(serviceAccount string) ([]string, error) {
return c.ScopesWithContext(context.Background(), serviceAccount)
}
// ScopesWithContext returns the service account scopes for the given account.
// The account may be empty or the string "default" to use the instance's
// main account.
func (c *Client) ScopesWithContext(ctx context.Context, serviceAccount string) ([]string, error) {
if serviceAccount == "" {
serviceAccount = "default"
}
return c.lines("instance/service-accounts/" + serviceAccount + "/scopes")
return c.lines(ctx, "instance/service-accounts/"+serviceAccount+"/scopes")
}
// Subscribe subscribes to a value from the metadata service.

View File

@ -1,6 +1,20 @@
# Changes
## [1.1.10](https://github.com/googleapis/google-cloud-go/compare/iam/v1.1.9...iam/v1.1.10) (2024-07-01)
### Bug Fixes
* **iam:** Bump google.golang.org/api@v0.187.0 ([8fa9e39](https://github.com/googleapis/google-cloud-go/commit/8fa9e398e512fd8533fd49060371e61b5725a85b))
## [1.1.9](https://github.com/googleapis/google-cloud-go/compare/iam/v1.1.8...iam/v1.1.9) (2024-06-26)
### Bug Fixes
* **iam:** Enable new auth lib ([b95805f](https://github.com/googleapis/google-cloud-go/commit/b95805f4c87d3e8d10ea23bd7a2d68d7a4157568))
## [1.1.8](https://github.com/googleapis/google-cloud-go/compare/iam/v1.1.7...iam/v1.1.8) (2024-05-01)

View File

@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc-gen-go v1.34.2
// protoc v4.25.3
// source: google/iam/v1/iam_policy.proto
@ -388,7 +388,7 @@ func file_google_iam_v1_iam_policy_proto_rawDescGZIP() []byte {
}
var file_google_iam_v1_iam_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_google_iam_v1_iam_policy_proto_goTypes = []interface{}{
var file_google_iam_v1_iam_policy_proto_goTypes = []any{
(*SetIamPolicyRequest)(nil), // 0: google.iam.v1.SetIamPolicyRequest
(*GetIamPolicyRequest)(nil), // 1: google.iam.v1.GetIamPolicyRequest
(*TestIamPermissionsRequest)(nil), // 2: google.iam.v1.TestIamPermissionsRequest
@ -422,7 +422,7 @@ func file_google_iam_v1_iam_policy_proto_init() {
file_google_iam_v1_options_proto_init()
file_google_iam_v1_policy_proto_init()
if !protoimpl.UnsafeEnabled {
file_google_iam_v1_iam_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_iam_policy_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*SetIamPolicyRequest); i {
case 0:
return &v.state
@ -434,7 +434,7 @@ func file_google_iam_v1_iam_policy_proto_init() {
return nil
}
}
file_google_iam_v1_iam_policy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_iam_policy_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*GetIamPolicyRequest); i {
case 0:
return &v.state
@ -446,7 +446,7 @@ func file_google_iam_v1_iam_policy_proto_init() {
return nil
}
}
file_google_iam_v1_iam_policy_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_iam_policy_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*TestIamPermissionsRequest); i {
case 0:
return &v.state
@ -458,7 +458,7 @@ func file_google_iam_v1_iam_policy_proto_init() {
return nil
}
}
file_google_iam_v1_iam_policy_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_iam_policy_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*TestIamPermissionsResponse); i {
case 0:
return &v.state

View File

@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc-gen-go v1.34.2
// protoc v4.25.3
// source: google/iam/v1/options.proto
@ -136,7 +136,7 @@ func file_google_iam_v1_options_proto_rawDescGZIP() []byte {
}
var file_google_iam_v1_options_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_google_iam_v1_options_proto_goTypes = []interface{}{
var file_google_iam_v1_options_proto_goTypes = []any{
(*GetPolicyOptions)(nil), // 0: google.iam.v1.GetPolicyOptions
}
var file_google_iam_v1_options_proto_depIdxs = []int32{
@ -153,7 +153,7 @@ func file_google_iam_v1_options_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_google_iam_v1_options_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_options_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*GetPolicyOptions); i {
case 0:
return &v.state

View File

@ -1,4 +1,4 @@
// Copyright 2023 Google LLC
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc-gen-go v1.34.2
// protoc v4.25.3
// source: google/iam/v1/policy.proto
@ -1036,7 +1036,7 @@ func file_google_iam_v1_policy_proto_rawDescGZIP() []byte {
var file_google_iam_v1_policy_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_google_iam_v1_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_google_iam_v1_policy_proto_goTypes = []interface{}{
var file_google_iam_v1_policy_proto_goTypes = []any{
(AuditLogConfig_LogType)(0), // 0: google.iam.v1.AuditLogConfig.LogType
(BindingDelta_Action)(0), // 1: google.iam.v1.BindingDelta.Action
(AuditConfigDelta_Action)(0), // 2: google.iam.v1.AuditConfigDelta.Action
@ -1073,7 +1073,7 @@ func file_google_iam_v1_policy_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_google_iam_v1_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_policy_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*Policy); i {
case 0:
return &v.state
@ -1085,7 +1085,7 @@ func file_google_iam_v1_policy_proto_init() {
return nil
}
}
file_google_iam_v1_policy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_policy_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*Binding); i {
case 0:
return &v.state
@ -1097,7 +1097,7 @@ func file_google_iam_v1_policy_proto_init() {
return nil
}
}
file_google_iam_v1_policy_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_policy_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*AuditConfig); i {
case 0:
return &v.state
@ -1109,7 +1109,7 @@ func file_google_iam_v1_policy_proto_init() {
return nil
}
}
file_google_iam_v1_policy_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_policy_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*AuditLogConfig); i {
case 0:
return &v.state
@ -1121,7 +1121,7 @@ func file_google_iam_v1_policy_proto_init() {
return nil
}
}
file_google_iam_v1_policy_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_policy_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*PolicyDelta); i {
case 0:
return &v.state
@ -1133,7 +1133,7 @@ func file_google_iam_v1_policy_proto_init() {
return nil
}
}
file_google_iam_v1_policy_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_policy_proto_msgTypes[5].Exporter = func(v any, i int) any {
switch v := v.(*BindingDelta); i {
case 0:
return &v.state
@ -1145,7 +1145,7 @@ func file_google_iam_v1_policy_proto_init() {
return nil
}
}
file_google_iam_v1_policy_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
file_google_iam_v1_policy_proto_msgTypes[6].Exporter = func(v any, i int) any {
switch v := v.(*AuditConfigDelta); i {
case 0:
return &v.state

View File

@ -217,9 +217,9 @@ type GenerateAccessTokenRequest struct {
NullFields []string `json:"-"`
}
func (s *GenerateAccessTokenRequest) MarshalJSON() ([]byte, error) {
func (s GenerateAccessTokenRequest) MarshalJSON() ([]byte, error) {
type NoMethod GenerateAccessTokenRequest
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type GenerateAccessTokenResponse struct {
@ -243,9 +243,9 @@ type GenerateAccessTokenResponse struct {
NullFields []string `json:"-"`
}
func (s *GenerateAccessTokenResponse) MarshalJSON() ([]byte, error) {
func (s GenerateAccessTokenResponse) MarshalJSON() ([]byte, error) {
type NoMethod GenerateAccessTokenResponse
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type GenerateIdTokenRequest struct {
@ -277,9 +277,9 @@ type GenerateIdTokenRequest struct {
NullFields []string `json:"-"`
}
func (s *GenerateIdTokenRequest) MarshalJSON() ([]byte, error) {
func (s GenerateIdTokenRequest) MarshalJSON() ([]byte, error) {
type NoMethod GenerateIdTokenRequest
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type GenerateIdTokenResponse struct {
@ -301,9 +301,9 @@ type GenerateIdTokenResponse struct {
NullFields []string `json:"-"`
}
func (s *GenerateIdTokenResponse) MarshalJSON() ([]byte, error) {
func (s GenerateIdTokenResponse) MarshalJSON() ([]byte, error) {
type NoMethod GenerateIdTokenResponse
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type SignBlobRequest struct {
@ -331,9 +331,9 @@ type SignBlobRequest struct {
NullFields []string `json:"-"`
}
func (s *SignBlobRequest) MarshalJSON() ([]byte, error) {
func (s SignBlobRequest) MarshalJSON() ([]byte, error) {
type NoMethod SignBlobRequest
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type SignBlobResponse struct {
@ -368,9 +368,9 @@ type SignBlobResponse struct {
NullFields []string `json:"-"`
}
func (s *SignBlobResponse) MarshalJSON() ([]byte, error) {
func (s SignBlobResponse) MarshalJSON() ([]byte, error) {
type NoMethod SignBlobResponse
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type SignJwtRequest struct {
@ -402,9 +402,9 @@ type SignJwtRequest struct {
NullFields []string `json:"-"`
}
func (s *SignJwtRequest) MarshalJSON() ([]byte, error) {
func (s SignJwtRequest) MarshalJSON() ([]byte, error) {
type NoMethod SignJwtRequest
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type SignJwtResponse struct {
@ -441,9 +441,9 @@ type SignJwtResponse struct {
NullFields []string `json:"-"`
}
func (s *SignJwtResponse) MarshalJSON() ([]byte, error) {
func (s SignJwtResponse) MarshalJSON() ([]byte, error) {
type NoMethod SignJwtResponse
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type ProjectsServiceAccountsGenerateAccessTokenCall struct {

View File

@ -127,7 +127,7 @@ func baseCreds(ctx context.Context, ds *DialSettings) (*google.Credentials, erro
if ds.Credentials != nil {
return ds.Credentials, nil
}
if ds.CredentialsJSON != nil {
if len(ds.CredentialsJSON) > 0 {
return credentialsFromJSON(ctx, ds.CredentialsJSON, ds)
}
if ds.CredentialsFile != "" {

View File

@ -126,7 +126,7 @@ func (ds *DialSettings) Validate() error {
if ds.Credentials != nil {
nCreds++
}
if ds.CredentialsJSON != nil {
if len(ds.CredentialsJSON) > 0 {
nCreds++
}
if ds.CredentialsFile != "" {

View File

@ -5,4 +5,4 @@
package internal
// Version is the current tagged release of the library.
const Version = "0.187.0"
const Version = "0.188.0"

View File

@ -388,9 +388,9 @@ type AnywhereCache struct {
NullFields []string `json:"-"`
}
func (s *AnywhereCache) MarshalJSON() ([]byte, error) {
func (s AnywhereCache) MarshalJSON() ([]byte, error) {
type NoMethod AnywhereCache
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// AnywhereCaches: A list of Anywhere Caches.
@ -420,9 +420,9 @@ type AnywhereCaches struct {
NullFields []string `json:"-"`
}
func (s *AnywhereCaches) MarshalJSON() ([]byte, error) {
func (s AnywhereCaches) MarshalJSON() ([]byte, error) {
type NoMethod AnywhereCaches
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Bucket: A bucket.
@ -548,9 +548,9 @@ type Bucket struct {
NullFields []string `json:"-"`
}
func (s *Bucket) MarshalJSON() ([]byte, error) {
func (s Bucket) MarshalJSON() ([]byte, error) {
type NoMethod Bucket
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketAutoclass: The bucket's Autoclass configuration.
@ -580,9 +580,9 @@ type BucketAutoclass struct {
NullFields []string `json:"-"`
}
func (s *BucketAutoclass) MarshalJSON() ([]byte, error) {
func (s BucketAutoclass) MarshalJSON() ([]byte, error) {
type NoMethod BucketAutoclass
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketBilling: The bucket's billing configuration.
@ -602,9 +602,9 @@ type BucketBilling struct {
NullFields []string `json:"-"`
}
func (s *BucketBilling) MarshalJSON() ([]byte, error) {
func (s BucketBilling) MarshalJSON() ([]byte, error) {
type NoMethod BucketBilling
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type BucketCors struct {
@ -634,9 +634,9 @@ type BucketCors struct {
NullFields []string `json:"-"`
}
func (s *BucketCors) MarshalJSON() ([]byte, error) {
func (s BucketCors) MarshalJSON() ([]byte, error) {
type NoMethod BucketCors
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketCustomPlacementConfig: The bucket's custom placement configuration for
@ -657,9 +657,9 @@ type BucketCustomPlacementConfig struct {
NullFields []string `json:"-"`
}
func (s *BucketCustomPlacementConfig) MarshalJSON() ([]byte, error) {
func (s BucketCustomPlacementConfig) MarshalJSON() ([]byte, error) {
type NoMethod BucketCustomPlacementConfig
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketEncryption: Encryption configuration for a bucket.
@ -680,9 +680,9 @@ type BucketEncryption struct {
NullFields []string `json:"-"`
}
func (s *BucketEncryption) MarshalJSON() ([]byte, error) {
func (s BucketEncryption) MarshalJSON() ([]byte, error) {
type NoMethod BucketEncryption
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketHierarchicalNamespace: The bucket's hierarchical namespace
@ -704,9 +704,9 @@ type BucketHierarchicalNamespace struct {
NullFields []string `json:"-"`
}
func (s *BucketHierarchicalNamespace) MarshalJSON() ([]byte, error) {
func (s BucketHierarchicalNamespace) MarshalJSON() ([]byte, error) {
type NoMethod BucketHierarchicalNamespace
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketIamConfiguration: The bucket's IAM configuration.
@ -736,9 +736,9 @@ type BucketIamConfiguration struct {
NullFields []string `json:"-"`
}
func (s *BucketIamConfiguration) MarshalJSON() ([]byte, error) {
func (s BucketIamConfiguration) MarshalJSON() ([]byte, error) {
type NoMethod BucketIamConfiguration
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketIamConfigurationBucketPolicyOnly: The bucket's uniform bucket-level
@ -768,9 +768,9 @@ type BucketIamConfigurationBucketPolicyOnly struct {
NullFields []string `json:"-"`
}
func (s *BucketIamConfigurationBucketPolicyOnly) MarshalJSON() ([]byte, error) {
func (s BucketIamConfigurationBucketPolicyOnly) MarshalJSON() ([]byte, error) {
type NoMethod BucketIamConfigurationBucketPolicyOnly
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketIamConfigurationUniformBucketLevelAccess: The bucket's uniform
@ -798,9 +798,9 @@ type BucketIamConfigurationUniformBucketLevelAccess struct {
NullFields []string `json:"-"`
}
func (s *BucketIamConfigurationUniformBucketLevelAccess) MarshalJSON() ([]byte, error) {
func (s BucketIamConfigurationUniformBucketLevelAccess) MarshalJSON() ([]byte, error) {
type NoMethod BucketIamConfigurationUniformBucketLevelAccess
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketLifecycle: The bucket's lifecycle configuration. See lifecycle
@ -822,9 +822,9 @@ type BucketLifecycle struct {
NullFields []string `json:"-"`
}
func (s *BucketLifecycle) MarshalJSON() ([]byte, error) {
func (s BucketLifecycle) MarshalJSON() ([]byte, error) {
type NoMethod BucketLifecycle
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type BucketLifecycleRule struct {
@ -845,9 +845,9 @@ type BucketLifecycleRule struct {
NullFields []string `json:"-"`
}
func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) {
func (s BucketLifecycleRule) MarshalJSON() ([]byte, error) {
type NoMethod BucketLifecycleRule
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketLifecycleRuleAction: The action to take.
@ -871,9 +871,9 @@ type BucketLifecycleRuleAction struct {
NullFields []string `json:"-"`
}
func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) {
func (s BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) {
type NoMethod BucketLifecycleRuleAction
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketLifecycleRuleCondition: The condition(s) under which the action will
@ -947,9 +947,9 @@ type BucketLifecycleRuleCondition struct {
NullFields []string `json:"-"`
}
func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) {
func (s BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) {
type NoMethod BucketLifecycleRuleCondition
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketLogging: The bucket's logging configuration, which defines the
@ -973,9 +973,9 @@ type BucketLogging struct {
NullFields []string `json:"-"`
}
func (s *BucketLogging) MarshalJSON() ([]byte, error) {
func (s BucketLogging) MarshalJSON() ([]byte, error) {
type NoMethod BucketLogging
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketObjectRetention: The bucket's object retention config.
@ -995,9 +995,9 @@ type BucketObjectRetention struct {
NullFields []string `json:"-"`
}
func (s *BucketObjectRetention) MarshalJSON() ([]byte, error) {
func (s BucketObjectRetention) MarshalJSON() ([]byte, error) {
type NoMethod BucketObjectRetention
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketOwner: The owner of the bucket. This is always the project team's
@ -1020,9 +1020,9 @@ type BucketOwner struct {
NullFields []string `json:"-"`
}
func (s *BucketOwner) MarshalJSON() ([]byte, error) {
func (s BucketOwner) MarshalJSON() ([]byte, error) {
type NoMethod BucketOwner
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketRetentionPolicy: The bucket's retention policy. The retention policy
@ -1058,9 +1058,9 @@ type BucketRetentionPolicy struct {
NullFields []string `json:"-"`
}
func (s *BucketRetentionPolicy) MarshalJSON() ([]byte, error) {
func (s BucketRetentionPolicy) MarshalJSON() ([]byte, error) {
type NoMethod BucketRetentionPolicy
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketSoftDeletePolicy: The bucket's soft delete policy, which defines the
@ -1087,9 +1087,9 @@ type BucketSoftDeletePolicy struct {
NullFields []string `json:"-"`
}
func (s *BucketSoftDeletePolicy) MarshalJSON() ([]byte, error) {
func (s BucketSoftDeletePolicy) MarshalJSON() ([]byte, error) {
type NoMethod BucketSoftDeletePolicy
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketVersioning: The bucket's versioning configuration.
@ -1109,9 +1109,9 @@ type BucketVersioning struct {
NullFields []string `json:"-"`
}
func (s *BucketVersioning) MarshalJSON() ([]byte, error) {
func (s BucketVersioning) MarshalJSON() ([]byte, error) {
type NoMethod BucketVersioning
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketWebsite: The bucket's website configuration, controlling how the
@ -1140,9 +1140,9 @@ type BucketWebsite struct {
NullFields []string `json:"-"`
}
func (s *BucketWebsite) MarshalJSON() ([]byte, error) {
func (s BucketWebsite) MarshalJSON() ([]byte, error) {
type NoMethod BucketWebsite
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketAccessControl: An access-control entry.
@ -1199,9 +1199,9 @@ type BucketAccessControl struct {
NullFields []string `json:"-"`
}
func (s *BucketAccessControl) MarshalJSON() ([]byte, error) {
func (s BucketAccessControl) MarshalJSON() ([]byte, error) {
type NoMethod BucketAccessControl
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketAccessControlProjectTeam: The project team associated with the entity,
@ -1224,9 +1224,9 @@ type BucketAccessControlProjectTeam struct {
NullFields []string `json:"-"`
}
func (s *BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
func (s BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
type NoMethod BucketAccessControlProjectTeam
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketAccessControls: An access-control list.
@ -1252,9 +1252,9 @@ type BucketAccessControls struct {
NullFields []string `json:"-"`
}
func (s *BucketAccessControls) MarshalJSON() ([]byte, error) {
func (s BucketAccessControls) MarshalJSON() ([]byte, error) {
type NoMethod BucketAccessControls
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketStorageLayout: The storage layout configuration of a bucket.
@ -1289,9 +1289,9 @@ type BucketStorageLayout struct {
NullFields []string `json:"-"`
}
func (s *BucketStorageLayout) MarshalJSON() ([]byte, error) {
func (s BucketStorageLayout) MarshalJSON() ([]byte, error) {
type NoMethod BucketStorageLayout
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketStorageLayoutCustomPlacementConfig: The bucket's custom placement
@ -1312,9 +1312,9 @@ type BucketStorageLayoutCustomPlacementConfig struct {
NullFields []string `json:"-"`
}
func (s *BucketStorageLayoutCustomPlacementConfig) MarshalJSON() ([]byte, error) {
func (s BucketStorageLayoutCustomPlacementConfig) MarshalJSON() ([]byte, error) {
type NoMethod BucketStorageLayoutCustomPlacementConfig
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BucketStorageLayoutHierarchicalNamespace: The bucket's hierarchical
@ -1336,9 +1336,9 @@ type BucketStorageLayoutHierarchicalNamespace struct {
NullFields []string `json:"-"`
}
func (s *BucketStorageLayoutHierarchicalNamespace) MarshalJSON() ([]byte, error) {
func (s BucketStorageLayoutHierarchicalNamespace) MarshalJSON() ([]byte, error) {
type NoMethod BucketStorageLayoutHierarchicalNamespace
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Buckets: A list of buckets.
@ -1368,9 +1368,9 @@ type Buckets struct {
NullFields []string `json:"-"`
}
func (s *Buckets) MarshalJSON() ([]byte, error) {
func (s Buckets) MarshalJSON() ([]byte, error) {
type NoMethod Buckets
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// BulkRestoreObjectsRequest: A bulk restore objects request.
@ -1409,9 +1409,9 @@ type BulkRestoreObjectsRequest struct {
NullFields []string `json:"-"`
}
func (s *BulkRestoreObjectsRequest) MarshalJSON() ([]byte, error) {
func (s BulkRestoreObjectsRequest) MarshalJSON() ([]byte, error) {
type NoMethod BulkRestoreObjectsRequest
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Channel: An notification channel used to watch for resource changes.
@ -1457,9 +1457,9 @@ type Channel struct {
NullFields []string `json:"-"`
}
func (s *Channel) MarshalJSON() ([]byte, error) {
func (s Channel) MarshalJSON() ([]byte, error) {
type NoMethod Channel
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ComposeRequest: A Compose request.
@ -1484,9 +1484,9 @@ type ComposeRequest struct {
NullFields []string `json:"-"`
}
func (s *ComposeRequest) MarshalJSON() ([]byte, error) {
func (s ComposeRequest) MarshalJSON() ([]byte, error) {
type NoMethod ComposeRequest
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type ComposeRequestSourceObjects struct {
@ -1511,9 +1511,9 @@ type ComposeRequestSourceObjects struct {
NullFields []string `json:"-"`
}
func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) {
func (s ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) {
type NoMethod ComposeRequestSourceObjects
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ComposeRequestSourceObjectsObjectPreconditions: Conditions that must be met
@ -1537,9 +1537,9 @@ type ComposeRequestSourceObjectsObjectPreconditions struct {
NullFields []string `json:"-"`
}
func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) {
func (s ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) {
type NoMethod ComposeRequestSourceObjectsObjectPreconditions
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Expr: Represents an expression text. Example: title: "User account presence"
@ -1573,9 +1573,9 @@ type Expr struct {
NullFields []string `json:"-"`
}
func (s *Expr) MarshalJSON() ([]byte, error) {
func (s Expr) MarshalJSON() ([]byte, error) {
type NoMethod Expr
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Folder: A folder. Only available in buckets with hierarchical namespace
@ -1618,9 +1618,9 @@ type Folder struct {
NullFields []string `json:"-"`
}
func (s *Folder) MarshalJSON() ([]byte, error) {
func (s Folder) MarshalJSON() ([]byte, error) {
type NoMethod Folder
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// FolderPendingRenameInfo: Only present if the folder is part of an ongoing
@ -1642,9 +1642,9 @@ type FolderPendingRenameInfo struct {
NullFields []string `json:"-"`
}
func (s *FolderPendingRenameInfo) MarshalJSON() ([]byte, error) {
func (s FolderPendingRenameInfo) MarshalJSON() ([]byte, error) {
type NoMethod FolderPendingRenameInfo
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Folders: A list of folders.
@ -1674,9 +1674,9 @@ type Folders struct {
NullFields []string `json:"-"`
}
func (s *Folders) MarshalJSON() ([]byte, error) {
func (s Folders) MarshalJSON() ([]byte, error) {
type NoMethod Folders
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// GoogleLongrunningListOperationsResponse: The response message for
@ -1708,9 +1708,9 @@ type GoogleLongrunningListOperationsResponse struct {
NullFields []string `json:"-"`
}
func (s *GoogleLongrunningListOperationsResponse) MarshalJSON() ([]byte, error) {
func (s GoogleLongrunningListOperationsResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleLongrunningListOperationsResponse
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// GoogleLongrunningOperation: This resource represents a long-running
@ -1760,9 +1760,9 @@ type GoogleLongrunningOperation struct {
NullFields []string `json:"-"`
}
func (s *GoogleLongrunningOperation) MarshalJSON() ([]byte, error) {
func (s GoogleLongrunningOperation) MarshalJSON() ([]byte, error) {
type NoMethod GoogleLongrunningOperation
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// GoogleRpcStatus: The "Status" type defines a logical error model that is
@ -1792,9 +1792,9 @@ type GoogleRpcStatus struct {
NullFields []string `json:"-"`
}
func (s *GoogleRpcStatus) MarshalJSON() ([]byte, error) {
func (s GoogleRpcStatus) MarshalJSON() ([]byte, error) {
type NoMethod GoogleRpcStatus
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// HmacKey: JSON template to produce a JSON-style HMAC Key resource for Create
@ -1823,9 +1823,9 @@ type HmacKey struct {
NullFields []string `json:"-"`
}
func (s *HmacKey) MarshalJSON() ([]byte, error) {
func (s HmacKey) MarshalJSON() ([]byte, error) {
type NoMethod HmacKey
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// HmacKeyMetadata: JSON template to produce a JSON-style HMAC Key metadata
@ -1871,9 +1871,9 @@ type HmacKeyMetadata struct {
NullFields []string `json:"-"`
}
func (s *HmacKeyMetadata) MarshalJSON() ([]byte, error) {
func (s HmacKeyMetadata) MarshalJSON() ([]byte, error) {
type NoMethod HmacKeyMetadata
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// HmacKeysMetadata: A list of hmacKeys.
@ -1903,9 +1903,9 @@ type HmacKeysMetadata struct {
NullFields []string `json:"-"`
}
func (s *HmacKeysMetadata) MarshalJSON() ([]byte, error) {
func (s HmacKeysMetadata) MarshalJSON() ([]byte, error) {
type NoMethod HmacKeysMetadata
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ManagedFolder: A managed folder.
@ -1947,9 +1947,9 @@ type ManagedFolder struct {
NullFields []string `json:"-"`
}
func (s *ManagedFolder) MarshalJSON() ([]byte, error) {
func (s ManagedFolder) MarshalJSON() ([]byte, error) {
type NoMethod ManagedFolder
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ManagedFolders: A list of managed folders.
@ -1979,9 +1979,9 @@ type ManagedFolders struct {
NullFields []string `json:"-"`
}
func (s *ManagedFolders) MarshalJSON() ([]byte, error) {
func (s ManagedFolders) MarshalJSON() ([]byte, error) {
type NoMethod ManagedFolders
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Notification: A subscription to receive Google PubSub notifications.
@ -2026,9 +2026,9 @@ type Notification struct {
NullFields []string `json:"-"`
}
func (s *Notification) MarshalJSON() ([]byte, error) {
func (s Notification) MarshalJSON() ([]byte, error) {
type NoMethod Notification
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Notifications: A list of notification subscriptions.
@ -2054,9 +2054,9 @@ type Notifications struct {
NullFields []string `json:"-"`
}
func (s *Notifications) MarshalJSON() ([]byte, error) {
func (s Notifications) MarshalJSON() ([]byte, error) {
type NoMethod Notifications
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Object: An object.
@ -2196,9 +2196,9 @@ type Object struct {
NullFields []string `json:"-"`
}
func (s *Object) MarshalJSON() ([]byte, error) {
func (s Object) MarshalJSON() ([]byte, error) {
type NoMethod Object
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ObjectCustomerEncryption: Metadata of customer-supplied encryption key, if
@ -2221,9 +2221,9 @@ type ObjectCustomerEncryption struct {
NullFields []string `json:"-"`
}
func (s *ObjectCustomerEncryption) MarshalJSON() ([]byte, error) {
func (s ObjectCustomerEncryption) MarshalJSON() ([]byte, error) {
type NoMethod ObjectCustomerEncryption
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ObjectOwner: The owner of the object. This will always be the uploader of
@ -2246,9 +2246,9 @@ type ObjectOwner struct {
NullFields []string `json:"-"`
}
func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
func (s ObjectOwner) MarshalJSON() ([]byte, error) {
type NoMethod ObjectOwner
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ObjectRetention: A collection of object level retention parameters.
@ -2271,9 +2271,9 @@ type ObjectRetention struct {
NullFields []string `json:"-"`
}
func (s *ObjectRetention) MarshalJSON() ([]byte, error) {
func (s ObjectRetention) MarshalJSON() ([]byte, error) {
type NoMethod ObjectRetention
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ObjectAccessControl: An access-control entry.
@ -2334,9 +2334,9 @@ type ObjectAccessControl struct {
NullFields []string `json:"-"`
}
func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) {
func (s ObjectAccessControl) MarshalJSON() ([]byte, error) {
type NoMethod ObjectAccessControl
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ObjectAccessControlProjectTeam: The project team associated with the entity,
@ -2359,9 +2359,9 @@ type ObjectAccessControlProjectTeam struct {
NullFields []string `json:"-"`
}
func (s *ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
func (s ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
type NoMethod ObjectAccessControlProjectTeam
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ObjectAccessControls: An access-control list.
@ -2387,9 +2387,9 @@ type ObjectAccessControls struct {
NullFields []string `json:"-"`
}
func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) {
func (s ObjectAccessControls) MarshalJSON() ([]byte, error) {
type NoMethod ObjectAccessControls
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Objects: A list of objects.
@ -2422,9 +2422,9 @@ type Objects struct {
NullFields []string `json:"-"`
}
func (s *Objects) MarshalJSON() ([]byte, error) {
func (s Objects) MarshalJSON() ([]byte, error) {
type NoMethod Objects
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// Policy: A bucket/object/managedFolder IAM policy.
@ -2463,9 +2463,9 @@ type Policy struct {
NullFields []string `json:"-"`
}
func (s *Policy) MarshalJSON() ([]byte, error) {
func (s Policy) MarshalJSON() ([]byte, error) {
type NoMethod Policy
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type PolicyBindings struct {
@ -2535,9 +2535,9 @@ type PolicyBindings struct {
NullFields []string `json:"-"`
}
func (s *PolicyBindings) MarshalJSON() ([]byte, error) {
func (s PolicyBindings) MarshalJSON() ([]byte, error) {
type NoMethod PolicyBindings
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// RewriteResponse: A rewrite response.
@ -2577,9 +2577,9 @@ type RewriteResponse struct {
NullFields []string `json:"-"`
}
func (s *RewriteResponse) MarshalJSON() ([]byte, error) {
func (s RewriteResponse) MarshalJSON() ([]byte, error) {
type NoMethod RewriteResponse
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// ServiceAccount: A subscription to receive Google PubSub notifications.
@ -2605,9 +2605,9 @@ type ServiceAccount struct {
NullFields []string `json:"-"`
}
func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
func (s ServiceAccount) MarshalJSON() ([]byte, error) {
type NoMethod ServiceAccount
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
// TestIamPermissionsResponse: A
@ -2656,9 +2656,9 @@ type TestIamPermissionsResponse struct {
NullFields []string `json:"-"`
}
func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
func (s TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
type NoMethod TestIamPermissionsResponse
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
}
type AnywhereCachesDisableCall struct {

18
vendor/modules.txt vendored
View File

@ -4,7 +4,7 @@ cloud.google.com/go/internal
cloud.google.com/go/internal/optional
cloud.google.com/go/internal/trace
cloud.google.com/go/internal/version
# cloud.google.com/go/auth v0.6.1
# cloud.google.com/go/auth v0.7.0
## explicit; go 1.20
cloud.google.com/go/auth
cloud.google.com/go/auth/credentials
@ -23,11 +23,11 @@ cloud.google.com/go/auth/internal/transport/cert
# cloud.google.com/go/auth/oauth2adapt v0.2.2
## explicit; go 1.19
cloud.google.com/go/auth/oauth2adapt
# cloud.google.com/go/compute/metadata v0.3.0
## explicit; go 1.19
# cloud.google.com/go/compute/metadata v0.4.0
## explicit; go 1.20
cloud.google.com/go/compute/metadata
# cloud.google.com/go/iam v1.1.8
## explicit; go 1.19
# cloud.google.com/go/iam v1.1.10
## explicit; go 1.20
cloud.google.com/go/iam
cloud.google.com/go/iam/apiv1/iampb
# cloud.google.com/go/storage v1.42.0
@ -1157,7 +1157,7 @@ golang.org/x/text/unicode/norm
# golang.org/x/time v0.5.0
## explicit; go 1.18
golang.org/x/time/rate
# google.golang.org/api v0.187.0
# google.golang.org/api v0.188.0
## explicit; go 1.20
google.golang.org/api/googleapi
google.golang.org/api/googleapi/transport
@ -1175,16 +1175,16 @@ google.golang.org/api/transport
google.golang.org/api/transport/grpc
google.golang.org/api/transport/http
google.golang.org/api/transport/http/internal/propagation
# google.golang.org/genproto v0.0.0-20240624140628-dc46fd24d27d
# google.golang.org/genproto v0.0.0-20240708141625-4ad9e859172b
## explicit; go 1.20
google.golang.org/genproto/googleapis/type/date
google.golang.org/genproto/googleapis/type/expr
google.golang.org/genproto/protobuf/field_mask
# google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4
# google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094
## explicit; go 1.20
google.golang.org/genproto/googleapis/api
google.golang.org/genproto/googleapis/api/annotations
# google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d
# google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b
## explicit; go 1.20
google.golang.org/genproto/googleapis/rpc/code
google.golang.org/genproto/googleapis/rpc/errdetails