build(deps): bump the go-deps group across 1 directory with 10 updates

Bumps the go-deps group with 8 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [cloud.google.com/go/compute](https://github.com/googleapis/google-cloud-go) | `1.27.1` | `1.27.3` |
| [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) | `1.42.0` | `1.43.0` |
| [github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://github.com/Azure/azure-sdk-for-go) | `1.6.0` | `1.7.0` |
| [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage](https://github.com/Azure/azure-sdk-for-go) | `1.5.0` | `1.6.0` |
| [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) | `1.54.10` | `1.54.18` |
| [github.com/gophercloud/gophercloud](https://github.com/gophercloud/gophercloud) | `1.12.0` | `1.13.0` |
| [github.com/openshift-online/ocm-sdk-go](https://github.com/openshift-online/ocm-sdk-go) | `0.1.425` | `0.1.429` |
| [github.com/osbuild/images](https://github.com/osbuild/images) | `0.69.0` | `0.70.0` |



Updates `cloud.google.com/go/compute` from 1.27.1 to 1.27.3
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/pubsub/v1.27.1...compute/v1.27.3)

Updates `cloud.google.com/go/storage` from 1.42.0 to 1.43.0
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.42.0...spanner/v1.43.0)

Updates `github.com/Azure/azure-sdk-for-go/sdk/azidentity` from 1.6.0 to 1.7.0
- [Release notes](https://github.com/Azure/azure-sdk-for-go/releases)
- [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md)
- [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/azcore/v1.6.0...sdk/azcore/v1.7.0)

Updates `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage` from 1.5.0 to 1.6.0
- [Release notes](https://github.com/Azure/azure-sdk-for-go/releases)
- [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md)
- [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/azcore/v1.5.0...sdk/azcore/v1.6.0)

Updates `github.com/aws/aws-sdk-go` from 1.54.10 to 1.54.18
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.54.10...v1.54.18)

Updates `github.com/gophercloud/gophercloud` from 1.12.0 to 1.13.0
- [Release notes](https://github.com/gophercloud/gophercloud/releases)
- [Changelog](https://github.com/gophercloud/gophercloud/blob/v1.13.0/CHANGELOG.md)
- [Commits](https://github.com/gophercloud/gophercloud/compare/v1.12.0...v1.13.0)

Updates `github.com/openshift-online/ocm-sdk-go` from 0.1.425 to 0.1.429
- [Release notes](https://github.com/openshift-online/ocm-sdk-go/releases)
- [Changelog](https://github.com/openshift-online/ocm-sdk-go/blob/main/CHANGES.md)
- [Commits](https://github.com/openshift-online/ocm-sdk-go/compare/v0.1.425...v0.1.429)

Updates `github.com/osbuild/images` from 0.69.0 to 0.70.0
- [Release notes](https://github.com/osbuild/images/releases)
- [Commits](https://github.com/osbuild/images/compare/v0.69.0...v0.70.0)

Updates `golang.org/x/sys` from 0.21.0 to 0.22.0
- [Commits](https://github.com/golang/sys/compare/v0.21.0...v0.22.0)

Updates `google.golang.org/api` from 0.186.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.186.0...v0.188.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/compute
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/Azure/azure-sdk-for-go/sdk/azidentity
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
- dependency-name: github.com/gophercloud/gophercloud
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/openshift-online/ocm-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
- dependency-name: github.com/osbuild/images
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2024-07-11 04:55:34 +00:00 committed by Tomáš Hozza
parent c6d669f2cc
commit 4ba7085068
153 changed files with 6445 additions and 1316 deletions

View file

@ -1,5 +1,27 @@
# 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)
### 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)

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

@ -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"
)
@ -73,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

@ -16,6 +16,7 @@ package grpctransport
import (
"context"
"crypto/tls"
"errors"
"fmt"
"net/http"
@ -45,6 +46,11 @@ var (
timeoutDialerOption grpc.DialOption
)
// ClientCertProvider is a function that returns a TLS client certificate to be
// used when opening TLS connections. It follows the same semantics as
// [crypto/tls.Config.GetClientCertificate].
type ClientCertProvider = func(*tls.CertificateRequestInfo) (*tls.Certificate, error)
// Options used to configure a [GRPCClientConnPool] from [Dial].
type Options struct {
// DisableTelemetry disables default telemetry (OpenTelemetry). An example
@ -69,6 +75,10 @@ type Options struct {
// Credentials used to add Authorization metadata to all requests. If set
// DetectOpts are ignored.
Credentials *auth.Credentials
// ClientCertProvider is a function that returns a TLS client certificate to
// be used when opening TLS connections. It follows the same semantics as
// crypto/tls.Config.GetClientCertificate.
ClientCertProvider ClientCertProvider
// DetectOpts configures settings for detect Application Default
// Credentials.
DetectOpts *credentials.DetectOptions
@ -77,6 +87,9 @@ type Options struct {
// configured for the client, which will be compared to the universe domain
// that is separately configured for the credentials.
UniverseDomain string
// APIKey specifies an API key to be used as the basis for authentication.
// If set DetectOpts are ignored.
APIKey string
// InternalOptions are NOT meant to be set directly by consumers of this
// package, they should only be set by generated client code.
@ -99,7 +112,8 @@ func (o *Options) validate() error {
if o.InternalOptions != nil && o.InternalOptions.SkipValidation {
return nil
}
hasCreds := o.Credentials != nil ||
hasCreds := o.APIKey != "" ||
o.Credentials != nil ||
(o.DetectOpts != nil && len(o.DetectOpts.CredentialsJSON) > 0) ||
(o.DetectOpts != nil && o.DetectOpts.CredentialsFile != "")
if o.DisableAuthentication && hasCreds {
@ -125,6 +139,13 @@ func (o *Options) resolveDetectOptions() *credentials.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 = credentials.GoogleMTLSTokenURL
}
return do
}
@ -189,9 +210,10 @@ func Dial(ctx context.Context, secure bool, opts *Options) (GRPCClientConnPool,
// return a GRPCClientConnPool if pool == 1 or else a pool of of them if >1
func dial(ctx context.Context, secure bool, opts *Options) (*grpc.ClientConn, error) {
tOpts := &transport.Options{
Endpoint: opts.Endpoint,
Client: opts.client(),
UniverseDomain: opts.UniverseDomain,
Endpoint: opts.Endpoint,
ClientCertProvider: opts.ClientCertProvider,
Client: opts.client(),
UniverseDomain: opts.UniverseDomain,
}
if io := opts.InternalOptions; io != nil {
tOpts.DefaultEndpointTemplate = io.DefaultEndpointTemplate
@ -213,8 +235,21 @@ func dial(ctx context.Context, secure bool, opts *Options) (*grpc.ClientConn, er
grpc.WithTransportCredentials(transportCreds),
}
// Authentication can only be sent when communicating over a secure connection.
if !opts.DisableAuthentication {
// Ensure the token exchange HTTP transport uses the same ClientCertProvider as the GRPC API transport.
opts.ClientCertProvider, err = transport.GetClientCertificateProvider(tOpts)
if err != nil {
return nil, err
}
if opts.APIKey != "" {
grpcOpts = append(grpcOpts,
grpc.WithPerRPCCredentials(&grpcKeyProvider{
apiKey: opts.APIKey,
metadata: opts.Metadata,
secure: secure,
}),
)
} else if !opts.DisableAuthentication {
metadata := opts.Metadata
var creds *auth.Credentials
@ -259,6 +294,26 @@ func dial(ctx context.Context, secure bool, opts *Options) (*grpc.ClientConn, er
return grpc.DialContext(ctx, endpoint, grpcOpts...)
}
// grpcKeyProvider satisfies https://pkg.go.dev/google.golang.org/grpc/credentials#PerRPCCredentials.
type grpcKeyProvider struct {
apiKey string
metadata map[string]string
secure bool
}
func (g *grpcKeyProvider) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
metadata := make(map[string]string, len(g.metadata)+1)
metadata["X-goog-api-key"] = g.apiKey
for k, v := range g.metadata {
metadata[k] = v
}
return metadata, nil
}
func (g *grpcKeyProvider) RequireTransportSecurity() bool {
return g.secure
}
// grpcCredentialsProvider satisfies https://pkg.go.dev/google.golang.org/grpc/credentials#PerRPCCredentials.
type grpcCredentialsProvider struct {
creds *auth.Credentials

View file

@ -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

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

@ -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 {

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

@ -17,7 +17,11 @@
package transport
import (
"crypto/tls"
"fmt"
"net"
"net/http"
"time"
"cloud.google.com/go/auth/credentials"
)
@ -49,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)
}
@ -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,
}
}

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

@ -15,4 +15,4 @@
package internal
// Version is the current tagged release of the library.
const Version = "1.27.1"
const Version = "1.27.3"

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

@ -1,6 +1,27 @@
# Changes
## [1.43.0](https://github.com/googleapis/google-cloud-go/compare/storage/v1.42.0...storage/v1.43.0) (2024-07-03)
### Features
* **storage/transfermanager:** Add DownloadDirectory ([#10430](https://github.com/googleapis/google-cloud-go/issues/10430)) ([0d0e5dd](https://github.com/googleapis/google-cloud-go/commit/0d0e5dd5214769cc2c197991c2ece1303bd600de))
* **storage/transfermanager:** Automatically shard downloads ([#10379](https://github.com/googleapis/google-cloud-go/issues/10379)) ([05816f9](https://github.com/googleapis/google-cloud-go/commit/05816f9fafd3132c371da37f3a879bb9e8e7e604))
### Bug Fixes
* **storage/transfermanager:** WaitAndClose waits for Callbacks to finish ([#10504](https://github.com/googleapis/google-cloud-go/issues/10504)) ([0e81002](https://github.com/googleapis/google-cloud-go/commit/0e81002b3a5e560c874d814d28a35a102311d9ef)), refs [#10502](https://github.com/googleapis/google-cloud-go/issues/10502)
* **storage:** Allow empty soft delete on Create ([#10394](https://github.com/googleapis/google-cloud-go/issues/10394)) ([d8bd2c1](https://github.com/googleapis/google-cloud-go/commit/d8bd2c1ffc4f27503a74ded438d8bfbdd7707c63)), refs [#10380](https://github.com/googleapis/google-cloud-go/issues/10380)
* **storage:** Bump google.golang.org/api@v0.187.0 ([8fa9e39](https://github.com/googleapis/google-cloud-go/commit/8fa9e398e512fd8533fd49060371e61b5725a85b))
* **storage:** Retry broken pipe error ([#10374](https://github.com/googleapis/google-cloud-go/issues/10374)) ([2f4daa1](https://github.com/googleapis/google-cloud-go/commit/2f4daa11acf9d3f260fa888333090359c4d9198e)), refs [#9178](https://github.com/googleapis/google-cloud-go/issues/9178)
### Documentation
* **storage/control:** Remove allowlist note from Folders RPCs ([d6c543c](https://github.com/googleapis/google-cloud-go/commit/d6c543c3969016c63e158a862fc173dff60fb8d9))
## [1.42.0](https://github.com/googleapis/google-cloud-go/compare/storage/v1.41.0...storage/v1.42.0) (2024-06-10)

View file

@ -2123,8 +2123,11 @@ func (p *SoftDeletePolicy) toRawSoftDeletePolicy() *raw.BucketSoftDeletePolicy {
return nil
}
// Excluding read only field EffectiveTime.
// ForceSendFields must be set to send a zero value for RetentionDuration and disable
// soft delete.
return &raw.BucketSoftDeletePolicy{
RetentionDurationSeconds: int64(p.RetentionDuration.Seconds()),
ForceSendFields: []string{"RetentionDurationSeconds"},
}
}

View file

@ -14,7 +14,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc-gen-go v1.34.2
// protoc v4.25.3
// source: google/storage/v2/storage.proto
@ -8968,7 +8968,7 @@ func file_google_storage_v2_storage_proto_rawDescGZIP() []byte {
var file_google_storage_v2_storage_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_google_storage_v2_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 79)
var file_google_storage_v2_storage_proto_goTypes = []interface{}{
var file_google_storage_v2_storage_proto_goTypes = []any{
(ServiceConstants_Values)(0), // 0: google.storage.v2.ServiceConstants.Values
(*DeleteBucketRequest)(nil), // 1: google.storage.v2.DeleteBucketRequest
(*GetBucketRequest)(nil), // 2: google.storage.v2.GetBucketRequest
@ -9241,7 +9241,7 @@ func file_google_storage_v2_storage_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_google_storage_v2_storage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*DeleteBucketRequest); i {
case 0:
return &v.state
@ -9253,7 +9253,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*GetBucketRequest); i {
case 0:
return &v.state
@ -9265,7 +9265,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*CreateBucketRequest); i {
case 0:
return &v.state
@ -9277,7 +9277,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*ListBucketsRequest); i {
case 0:
return &v.state
@ -9289,7 +9289,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*ListBucketsResponse); i {
case 0:
return &v.state
@ -9301,7 +9301,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[5].Exporter = func(v any, i int) any {
switch v := v.(*LockBucketRetentionPolicyRequest); i {
case 0:
return &v.state
@ -9313,7 +9313,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[6].Exporter = func(v any, i int) any {
switch v := v.(*UpdateBucketRequest); i {
case 0:
return &v.state
@ -9325,7 +9325,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[7].Exporter = func(v any, i int) any {
switch v := v.(*DeleteNotificationConfigRequest); i {
case 0:
return &v.state
@ -9337,7 +9337,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[8].Exporter = func(v any, i int) any {
switch v := v.(*GetNotificationConfigRequest); i {
case 0:
return &v.state
@ -9349,7 +9349,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[9].Exporter = func(v any, i int) any {
switch v := v.(*CreateNotificationConfigRequest); i {
case 0:
return &v.state
@ -9361,7 +9361,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[10].Exporter = func(v any, i int) any {
switch v := v.(*ListNotificationConfigsRequest); i {
case 0:
return &v.state
@ -9373,7 +9373,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[11].Exporter = func(v any, i int) any {
switch v := v.(*ListNotificationConfigsResponse); i {
case 0:
return &v.state
@ -9385,7 +9385,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[12].Exporter = func(v any, i int) any {
switch v := v.(*ComposeObjectRequest); i {
case 0:
return &v.state
@ -9397,7 +9397,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[13].Exporter = func(v any, i int) any {
switch v := v.(*DeleteObjectRequest); i {
case 0:
return &v.state
@ -9409,7 +9409,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[14].Exporter = func(v any, i int) any {
switch v := v.(*RestoreObjectRequest); i {
case 0:
return &v.state
@ -9421,7 +9421,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[15].Exporter = func(v any, i int) any {
switch v := v.(*CancelResumableWriteRequest); i {
case 0:
return &v.state
@ -9433,7 +9433,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[16].Exporter = func(v any, i int) any {
switch v := v.(*CancelResumableWriteResponse); i {
case 0:
return &v.state
@ -9445,7 +9445,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[17].Exporter = func(v any, i int) any {
switch v := v.(*ReadObjectRequest); i {
case 0:
return &v.state
@ -9457,7 +9457,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[18].Exporter = func(v any, i int) any {
switch v := v.(*GetObjectRequest); i {
case 0:
return &v.state
@ -9469,7 +9469,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[19].Exporter = func(v any, i int) any {
switch v := v.(*ReadObjectResponse); i {
case 0:
return &v.state
@ -9481,7 +9481,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[20].Exporter = func(v any, i int) any {
switch v := v.(*WriteObjectSpec); i {
case 0:
return &v.state
@ -9493,7 +9493,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[21].Exporter = func(v any, i int) any {
switch v := v.(*WriteObjectRequest); i {
case 0:
return &v.state
@ -9505,7 +9505,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[22].Exporter = func(v any, i int) any {
switch v := v.(*WriteObjectResponse); i {
case 0:
return &v.state
@ -9517,7 +9517,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[23].Exporter = func(v any, i int) any {
switch v := v.(*BidiWriteObjectRequest); i {
case 0:
return &v.state
@ -9529,7 +9529,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[24].Exporter = func(v any, i int) any {
switch v := v.(*BidiWriteObjectResponse); i {
case 0:
return &v.state
@ -9541,7 +9541,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[25].Exporter = func(v any, i int) any {
switch v := v.(*ListObjectsRequest); i {
case 0:
return &v.state
@ -9553,7 +9553,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[26].Exporter = func(v any, i int) any {
switch v := v.(*QueryWriteStatusRequest); i {
case 0:
return &v.state
@ -9565,7 +9565,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[27].Exporter = func(v any, i int) any {
switch v := v.(*QueryWriteStatusResponse); i {
case 0:
return &v.state
@ -9577,7 +9577,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[28].Exporter = func(v any, i int) any {
switch v := v.(*RewriteObjectRequest); i {
case 0:
return &v.state
@ -9589,7 +9589,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[29].Exporter = func(v any, i int) any {
switch v := v.(*RewriteResponse); i {
case 0:
return &v.state
@ -9601,7 +9601,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[30].Exporter = func(v any, i int) any {
switch v := v.(*StartResumableWriteRequest); i {
case 0:
return &v.state
@ -9613,7 +9613,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[31].Exporter = func(v any, i int) any {
switch v := v.(*StartResumableWriteResponse); i {
case 0:
return &v.state
@ -9625,7 +9625,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[32].Exporter = func(v any, i int) any {
switch v := v.(*UpdateObjectRequest); i {
case 0:
return &v.state
@ -9637,7 +9637,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[33].Exporter = func(v any, i int) any {
switch v := v.(*GetServiceAccountRequest); i {
case 0:
return &v.state
@ -9649,7 +9649,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[34].Exporter = func(v any, i int) any {
switch v := v.(*CreateHmacKeyRequest); i {
case 0:
return &v.state
@ -9661,7 +9661,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[35].Exporter = func(v any, i int) any {
switch v := v.(*CreateHmacKeyResponse); i {
case 0:
return &v.state
@ -9673,7 +9673,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[36].Exporter = func(v any, i int) any {
switch v := v.(*DeleteHmacKeyRequest); i {
case 0:
return &v.state
@ -9685,7 +9685,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[37].Exporter = func(v any, i int) any {
switch v := v.(*GetHmacKeyRequest); i {
case 0:
return &v.state
@ -9697,7 +9697,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[38].Exporter = func(v any, i int) any {
switch v := v.(*ListHmacKeysRequest); i {
case 0:
return &v.state
@ -9709,7 +9709,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[39].Exporter = func(v any, i int) any {
switch v := v.(*ListHmacKeysResponse); i {
case 0:
return &v.state
@ -9721,7 +9721,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[40].Exporter = func(v any, i int) any {
switch v := v.(*UpdateHmacKeyRequest); i {
case 0:
return &v.state
@ -9733,7 +9733,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[41].Exporter = func(v any, i int) any {
switch v := v.(*CommonObjectRequestParams); i {
case 0:
return &v.state
@ -9745,7 +9745,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[42].Exporter = func(v any, i int) any {
switch v := v.(*ServiceConstants); i {
case 0:
return &v.state
@ -9757,7 +9757,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[43].Exporter = func(v any, i int) any {
switch v := v.(*Bucket); i {
case 0:
return &v.state
@ -9769,7 +9769,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[44].Exporter = func(v any, i int) any {
switch v := v.(*BucketAccessControl); i {
case 0:
return &v.state
@ -9781,7 +9781,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[45].Exporter = func(v any, i int) any {
switch v := v.(*ChecksummedData); i {
case 0:
return &v.state
@ -9793,7 +9793,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[46].Exporter = func(v any, i int) any {
switch v := v.(*ObjectChecksums); i {
case 0:
return &v.state
@ -9805,7 +9805,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[47].Exporter = func(v any, i int) any {
switch v := v.(*HmacKeyMetadata); i {
case 0:
return &v.state
@ -9817,7 +9817,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[48].Exporter = func(v any, i int) any {
switch v := v.(*NotificationConfig); i {
case 0:
return &v.state
@ -9829,7 +9829,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[49].Exporter = func(v any, i int) any {
switch v := v.(*CustomerEncryption); i {
case 0:
return &v.state
@ -9841,7 +9841,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[50].Exporter = func(v any, i int) any {
switch v := v.(*Object); i {
case 0:
return &v.state
@ -9853,7 +9853,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[51].Exporter = func(v any, i int) any {
switch v := v.(*ObjectAccessControl); i {
case 0:
return &v.state
@ -9865,7 +9865,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[52].Exporter = func(v any, i int) any {
switch v := v.(*ListObjectsResponse); i {
case 0:
return &v.state
@ -9877,7 +9877,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[53].Exporter = func(v any, i int) any {
switch v := v.(*ProjectTeam); i {
case 0:
return &v.state
@ -9889,7 +9889,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[54].Exporter = func(v any, i int) any {
switch v := v.(*ServiceAccount); i {
case 0:
return &v.state
@ -9901,7 +9901,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[55].Exporter = func(v any, i int) any {
switch v := v.(*Owner); i {
case 0:
return &v.state
@ -9913,7 +9913,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[56].Exporter = func(v any, i int) any {
switch v := v.(*ContentRange); i {
case 0:
return &v.state
@ -9925,7 +9925,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[57].Exporter = func(v any, i int) any {
switch v := v.(*ComposeObjectRequest_SourceObject); i {
case 0:
return &v.state
@ -9937,7 +9937,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[58].Exporter = func(v any, i int) any {
switch v := v.(*ComposeObjectRequest_SourceObject_ObjectPreconditions); i {
case 0:
return &v.state
@ -9949,7 +9949,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[59].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Billing); i {
case 0:
return &v.state
@ -9961,7 +9961,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[60].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Cors); i {
case 0:
return &v.state
@ -9973,7 +9973,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[61].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Encryption); i {
case 0:
return &v.state
@ -9985,7 +9985,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[62].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_IamConfig); i {
case 0:
return &v.state
@ -9997,7 +9997,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[63].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Lifecycle); i {
case 0:
return &v.state
@ -10009,7 +10009,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[64].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Logging); i {
case 0:
return &v.state
@ -10021,7 +10021,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[65].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_RetentionPolicy); i {
case 0:
return &v.state
@ -10033,7 +10033,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[66].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_SoftDeletePolicy); i {
case 0:
return &v.state
@ -10045,7 +10045,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[67].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Versioning); i {
case 0:
return &v.state
@ -10057,7 +10057,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[68].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Website); i {
case 0:
return &v.state
@ -10069,7 +10069,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[69].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_CustomPlacementConfig); i {
case 0:
return &v.state
@ -10081,7 +10081,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[70].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Autoclass); i {
case 0:
return &v.state
@ -10093,7 +10093,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[71].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_HierarchicalNamespace); i {
case 0:
return &v.state
@ -10105,7 +10105,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[73].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_IamConfig_UniformBucketLevelAccess); i {
case 0:
return &v.state
@ -10117,7 +10117,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[74].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[74].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Lifecycle_Rule); i {
case 0:
return &v.state
@ -10129,7 +10129,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[75].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[75].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Lifecycle_Rule_Action); i {
case 0:
return &v.state
@ -10141,7 +10141,7 @@ func file_google_storage_v2_storage_proto_init() {
return nil
}
}
file_google_storage_v2_storage_proto_msgTypes[76].Exporter = func(v interface{}, i int) interface{} {
file_google_storage_v2_storage_proto_msgTypes[76].Exporter = func(v any, i int) any {
switch v := v.(*Bucket_Lifecycle_Rule_Condition); i {
case 0:
return &v.state
@ -10154,48 +10154,48 @@ func file_google_storage_v2_storage_proto_init() {
}
}
}
file_google_storage_v2_storage_proto_msgTypes[0].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[1].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[3].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[6].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[12].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[13].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[14].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[17].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[18].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[20].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[21].OneofWrappers = []interface{}{
file_google_storage_v2_storage_proto_msgTypes[0].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[1].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[3].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[6].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[12].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[13].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[14].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[17].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[18].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[20].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[21].OneofWrappers = []any{
(*WriteObjectRequest_UploadId)(nil),
(*WriteObjectRequest_WriteObjectSpec)(nil),
(*WriteObjectRequest_ChecksummedData)(nil),
}
file_google_storage_v2_storage_proto_msgTypes[22].OneofWrappers = []interface{}{
file_google_storage_v2_storage_proto_msgTypes[22].OneofWrappers = []any{
(*WriteObjectResponse_PersistedSize)(nil),
(*WriteObjectResponse_Resource)(nil),
}
file_google_storage_v2_storage_proto_msgTypes[23].OneofWrappers = []interface{}{
file_google_storage_v2_storage_proto_msgTypes[23].OneofWrappers = []any{
(*BidiWriteObjectRequest_UploadId)(nil),
(*BidiWriteObjectRequest_WriteObjectSpec)(nil),
(*BidiWriteObjectRequest_ChecksummedData)(nil),
}
file_google_storage_v2_storage_proto_msgTypes[24].OneofWrappers = []interface{}{
file_google_storage_v2_storage_proto_msgTypes[24].OneofWrappers = []any{
(*BidiWriteObjectResponse_PersistedSize)(nil),
(*BidiWriteObjectResponse_Resource)(nil),
}
file_google_storage_v2_storage_proto_msgTypes[25].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[27].OneofWrappers = []interface{}{
file_google_storage_v2_storage_proto_msgTypes[25].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[27].OneofWrappers = []any{
(*QueryWriteStatusResponse_PersistedSize)(nil),
(*QueryWriteStatusResponse_Resource)(nil),
}
file_google_storage_v2_storage_proto_msgTypes[28].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[32].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[45].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[46].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[50].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[58].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[66].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[70].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[76].OneofWrappers = []interface{}{}
file_google_storage_v2_storage_proto_msgTypes[28].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[32].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[45].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[46].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[50].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[58].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[66].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[70].OneofWrappers = []any{}
file_google_storage_v2_storage_proto_msgTypes[76].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{

View file

@ -15,4 +15,4 @@
package internal
// Version is the current tagged release of the library.
const Version = "1.42.0"
const Version = "1.43.0"

View file

@ -132,7 +132,7 @@ func ShouldRetry(err error) bool {
// Retry socket-level errors ECONNREFUSED and ECONNRESET (from syscall).
// Unfortunately the error type is unexported, so we resort to string
// matching.
retriable := []string{"connection refused", "connection reset"}
retriable := []string{"connection refused", "connection reset", "broken pipe"}
for _, s := range retriable {
if strings.Contains(e.Error(), s) {
return true