diff --git a/accessapproval/apiv1/doc.go b/accessapproval/apiv1/doc.go index be021c2b5e6..385451f30fb 100644 --- a/accessapproval/apiv1/doc.go +++ b/accessapproval/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/analytics/admin/apiv1alpha/analytics_admin_client.go b/analytics/admin/apiv1alpha/analytics_admin_client.go index 1fb4f622f1b..48469f8a1f5 100644 --- a/analytics/admin/apiv1alpha/analytics_admin_client.go +++ b/analytics/admin/apiv1alpha/analytics_admin_client.go @@ -265,8 +265,6 @@ func (c *AnalyticsAdminClient) setGoogleClientInfo(keyval ...string) { } // GetAccount lookup for a single Account. -// Throws “Target not found” if no such account found, or if caller does not -// have permissions to access it. func (c *AnalyticsAdminClient) GetAccount(ctx context.Context, req *adminpb.GetAccountRequest, opts ...gax.CallOption) (*adminpb.Account, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) @@ -444,9 +442,6 @@ func (c *AnalyticsAdminClient) ListAccountSummaries(ctx context.Context, req *ad } // GetProperty lookup for a single “GA4” Property. -// -// Throws “Target not found” if no such property found, if property is not -// of the type “GA4”, or if caller does not have permissions to access it. func (c *AnalyticsAdminClient) GetProperty(ctx context.Context, req *adminpb.GetPropertyRequest, opts ...gax.CallOption) (*adminpb.Property, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) @@ -850,9 +845,6 @@ func (c *AnalyticsAdminClient) BatchDeleteUserLinks(ctx context.Context, req *ad } // GetWebDataStream lookup for a single WebDataStream -// -// Throws “Target not found” if no such web data stream found, or if the -// caller does not have permissions to access it. func (c *AnalyticsAdminClient) GetWebDataStream(ctx context.Context, req *adminpb.GetWebDataStreamRequest, opts ...gax.CallOption) (*adminpb.WebDataStream, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) @@ -981,9 +973,6 @@ func (c *AnalyticsAdminClient) ListWebDataStreams(ctx context.Context, req *admi } // GetIosAppDataStream lookup for a single IosAppDataStream -// -// Throws “Target not found” if no such iOS app data stream found, or if the -// caller does not have permissions to access it. func (c *AnalyticsAdminClient) GetIosAppDataStream(ctx context.Context, req *adminpb.GetIosAppDataStreamRequest, opts ...gax.CallOption) (*adminpb.IosAppDataStream, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) @@ -1112,9 +1101,6 @@ func (c *AnalyticsAdminClient) ListIosAppDataStreams(ctx context.Context, req *a } // GetAndroidAppDataStream lookup for a single AndroidAppDataStream -// -// Throws “Target not found” if no such android app data stream found, or if -// the caller does not have permissions to access it. func (c *AnalyticsAdminClient) GetAndroidAppDataStream(ctx context.Context, req *adminpb.GetAndroidAppDataStreamRequest, opts ...gax.CallOption) (*adminpb.AndroidAppDataStream, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) @@ -1356,25 +1342,44 @@ func (c *AnalyticsAdminClient) DeleteFirebaseLink(ctx context.Context, req *admi // ListFirebaseLinks lists FirebaseLinks on a property. // Properties can have at most one FirebaseLink. -func (c *AnalyticsAdminClient) ListFirebaseLinks(ctx context.Context, req *adminpb.ListFirebaseLinksRequest, opts ...gax.CallOption) (*adminpb.ListFirebaseLinksResponse, error) { - if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) - defer cancel() - ctx = cctx - } +func (c *AnalyticsAdminClient) ListFirebaseLinks(ctx context.Context, req *adminpb.ListFirebaseLinksRequest, opts ...gax.CallOption) *FirebaseLinkIterator { md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append(c.CallOptions.ListFirebaseLinks[0:len(c.CallOptions.ListFirebaseLinks):len(c.CallOptions.ListFirebaseLinks)], opts...) - var resp *adminpb.ListFirebaseLinksResponse - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.analyticsAdminClient.ListFirebaseLinks(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, err + it := &FirebaseLinkIterator{} + req = proto.Clone(req).(*adminpb.ListFirebaseLinksRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.FirebaseLink, string, error) { + var resp *adminpb.ListFirebaseLinksResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.ListFirebaseLinks(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetFirebaseLinks(), resp.GetNextPageToken(), nil } - return resp, nil + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it } // GetGlobalSiteTag returns the Site Tag for the specified web stream. @@ -1714,6 +1719,53 @@ func (it *AuditUserLinkIterator) takeBuf() interface{} { return b } +// FirebaseLinkIterator manages a stream of *adminpb.FirebaseLink. +type FirebaseLinkIterator struct { + items []*adminpb.FirebaseLink + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*adminpb.FirebaseLink, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *FirebaseLinkIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *FirebaseLinkIterator) Next() (*adminpb.FirebaseLink, error) { + var item *adminpb.FirebaseLink + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *FirebaseLinkIterator) bufLen() int { + return len(it.items) +} + +func (it *FirebaseLinkIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + // GoogleAdsLinkIterator manages a stream of *adminpb.GoogleAdsLink. type GoogleAdsLinkIterator struct { items []*adminpb.GoogleAdsLink diff --git a/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go b/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go index f80c1cc5e74..322f204ad69 100644 --- a/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go +++ b/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go @@ -880,6 +880,7 @@ func ExampleAnalyticsAdminClient_DeleteFirebaseLink() { func ExampleAnalyticsAdminClient_ListFirebaseLinks() { // import adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" + // import "google.golang.org/api/iterator" ctx := context.Background() c, err := admin.NewAnalyticsAdminClient(ctx) @@ -890,12 +891,18 @@ func ExampleAnalyticsAdminClient_ListFirebaseLinks() { req := &adminpb.ListFirebaseLinksRequest{ // TODO: Fill request struct fields. } - resp, err := c.ListFirebaseLinks(ctx, req) - if err != nil { - // TODO: Handle error. + it := c.ListFirebaseLinks(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp } - // TODO: Use resp. - _ = resp } func ExampleAnalyticsAdminClient_GetGlobalSiteTag() { diff --git a/analytics/admin/apiv1alpha/doc.go b/analytics/admin/apiv1alpha/doc.go index c99888da291..4f8f76224cc 100644 --- a/analytics/admin/apiv1alpha/doc.go +++ b/analytics/admin/apiv1alpha/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/analytics/data/apiv1alpha/doc.go b/analytics/data/apiv1alpha/doc.go index 212acbe857e..fb7bc09fd51 100644 --- a/analytics/data/apiv1alpha/doc.go +++ b/analytics/data/apiv1alpha/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/area120/tables/apiv1alpha1/doc.go b/area120/tables/apiv1alpha1/doc.go index cb46fc00e94..d3d7506b142 100644 --- a/area120/tables/apiv1alpha1/doc.go +++ b/area120/tables/apiv1alpha1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/artifactregistry/apiv1beta2/doc.go b/artifactregistry/apiv1beta2/doc.go index bee5132a6bf..20650cf16bb 100644 --- a/artifactregistry/apiv1beta2/doc.go +++ b/artifactregistry/apiv1beta2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1/doc.go b/asset/apiv1/doc.go index fb9c2d5ed7d..d867205d783 100644 --- a/asset/apiv1/doc.go +++ b/asset/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1p2beta1/doc.go b/asset/apiv1p2beta1/doc.go index 95994fa9be8..0081bc9e1e4 100644 --- a/asset/apiv1p2beta1/doc.go +++ b/asset/apiv1p2beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1p5beta1/doc.go b/asset/apiv1p5beta1/doc.go index f6af9c6a7a1..6ccbb76ec56 100644 --- a/asset/apiv1p5beta1/doc.go +++ b/asset/apiv1p5beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/assuredworkloads/apiv1beta1/doc.go b/assuredworkloads/apiv1beta1/doc.go index 52ef6bbfff1..7754a81ef9e 100644 --- a/assuredworkloads/apiv1beta1/doc.go +++ b/assuredworkloads/apiv1beta1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/automl/apiv1/doc.go b/automl/apiv1/doc.go index e0177315d2e..d87482fdad6 100644 --- a/automl/apiv1/doc.go +++ b/automl/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/automl/apiv1beta1/doc.go b/automl/apiv1beta1/doc.go index ef7b4fbc6d4..b6dd38ed24b 100644 --- a/automl/apiv1beta1/doc.go +++ b/automl/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/connection/apiv1/doc.go b/bigquery/connection/apiv1/doc.go index 019eb95ef90..c8d5832d6bf 100644 --- a/bigquery/connection/apiv1/doc.go +++ b/bigquery/connection/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/connection/apiv1beta1/doc.go b/bigquery/connection/apiv1beta1/doc.go index 26825632c36..49aa1cfa288 100644 --- a/bigquery/connection/apiv1beta1/doc.go +++ b/bigquery/connection/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/datatransfer/apiv1/doc.go b/bigquery/datatransfer/apiv1/doc.go index 6b0cac32128..0b13329fb3f 100644 --- a/bigquery/datatransfer/apiv1/doc.go +++ b/bigquery/datatransfer/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/go.mod b/bigquery/go.mod index 5c718485ae4..333e417b8a3 100644 --- a/bigquery/go.mod +++ b/bigquery/go.mod @@ -10,8 +10,8 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/mod v0.4.1 // indirect golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 // indirect - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 ) diff --git a/bigquery/go.sum b/bigquery/go.sum index 472451b51b5..e5141fec6cb 100644 --- a/bigquery/go.sum +++ b/bigquery/go.sum @@ -427,8 +427,8 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -523,8 +523,8 @@ google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/bigquery/reservation/apiv1/doc.go b/bigquery/reservation/apiv1/doc.go index 44212c66fab..1a728fc3545 100644 --- a/bigquery/reservation/apiv1/doc.go +++ b/bigquery/reservation/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/reservation/apiv1beta1/doc.go b/bigquery/reservation/apiv1beta1/doc.go index c1bd63800b5..72df29450d8 100644 --- a/bigquery/reservation/apiv1beta1/doc.go +++ b/bigquery/reservation/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1/doc.go b/bigquery/storage/apiv1/doc.go index cf98e886a4d..998ed22fdf6 100644 --- a/bigquery/storage/apiv1/doc.go +++ b/bigquery/storage/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1alpha2/doc.go b/bigquery/storage/apiv1alpha2/doc.go index 8294728a502..9917363c3f0 100644 --- a/bigquery/storage/apiv1alpha2/doc.go +++ b/bigquery/storage/apiv1alpha2/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1beta1/doc.go b/bigquery/storage/apiv1beta1/doc.go index 1053f9298ab..c541046d970 100644 --- a/bigquery/storage/apiv1beta1/doc.go +++ b/bigquery/storage/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1beta2/doc.go b/bigquery/storage/apiv1beta2/doc.go index 4912834998e..f66ce280c87 100644 --- a/bigquery/storage/apiv1beta2/doc.go +++ b/bigquery/storage/apiv1beta2/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigtable/CHANGES.md b/bigtable/CHANGES.md index 344cf2fb0c2..ff508ebaff1 100644 --- a/bigtable/CHANGES.md +++ b/bigtable/CHANGES.md @@ -1,5 +1,15 @@ # Changes +## [1.7.0](https://www.github.com/googleapis/google-cloud-go/compare/bigtable/v1.6.0...v1.7.0) (2021-01-19) + + +### Features + +* **bigtable:** Add a DirectPath fallback integration test ([#3384](https://www.github.com/googleapis/google-cloud-go/issues/3384)) ([e6684c3](https://www.github.com/googleapis/google-cloud-go/commit/e6684c39599221e9a1e22a790305e42e8ce5d903)) +* **bigtable:** attempt DirectPath by default ([#3558](https://www.github.com/googleapis/google-cloud-go/issues/3558)) ([330a3f4](https://www.github.com/googleapis/google-cloud-go/commit/330a3f489e3c534f647549be11f342997243ec3b)) +* **bigtable:** Backup Level IAM ([#3222](https://www.github.com/googleapis/google-cloud-go/issues/3222)) ([c77c822](https://www.github.com/googleapis/google-cloud-go/commit/c77c822b5aadb0f5f3ae9381acafdee496047f8a)) +* **bigtable:** run E2E test over DirectPath ([#3116](https://www.github.com/googleapis/google-cloud-go/issues/3116)) ([948452c](https://www.github.com/googleapis/google-cloud-go/commit/948452ce896d3f44c0e22cdaf69e122f26a3c912)) + ## v1.6.0 - Add support partial results in InstanceAdminClient.Instances. In the case of partial availability, available instances will be returned along with an diff --git a/bigtable/bigtable.go b/bigtable/bigtable.go index febec4c056f..26384139fba 100644 --- a/bigtable/bigtable.go +++ b/bigtable/bigtable.go @@ -30,6 +30,7 @@ import ( "github.com/golang/protobuf/proto" gax "github.com/googleapis/gax-go/v2" "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" btpb "google.golang.org/genproto/googleapis/bigtable/v2" "google.golang.org/grpc" @@ -81,6 +82,9 @@ func NewClientWithConfig(ctx context.Context, project, instance string, config C // TODO(grpc/grpc-go#1388) using connection pool without WithBlock // can cause RPCs to fail randomly. We can delete this after the issue is fixed. option.WithGRPCDialOption(grpc.WithBlock())) + // Attempts direct access to spanner service over gRPC to improve throughput, + // whether the attempt is allowed is totally controlled by service owner. + o = append(o, internaloption.EnableDirectPath(true)) o = append(o, opts...) connPool, err := gtransport.DialPool(ctx, o...) if err != nil { diff --git a/bigtable/export_test.go b/bigtable/export_test.go index fd84c499585..84ac9608336 100644 --- a/bigtable/export_test.go +++ b/bigtable/export_test.go @@ -28,7 +28,6 @@ import ( btopt "cloud.google.com/go/bigtable/internal/option" "cloud.google.com/go/internal/testutil" "google.golang.org/api/option" - "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" "google.golang.org/grpc" "google.golang.org/grpc/peer" @@ -269,8 +268,6 @@ func (e *ProdEnv) NewClient() (*Client, error) { } if e.config.AttemptDirectPath { - // TODO(mohanli): Move the EnableDirectPath internal option to bigtable.go after e2e tests are done. - clientOpts = append(clientOpts, internaloption.EnableDirectPath(true)) // For DirectPath tests, we need to add an interceptor to check the peer IP. clientOpts = append(clientOpts, option.WithGRPCDialOption(grpc.WithDefaultCallOptions(grpc.Peer(e.peerInfo)))) } diff --git a/bigtable/go.mod b/bigtable/go.mod index 9eb574927c8..a66080b0548 100644 --- a/bigtable/go.mod +++ b/bigtable/go.mod @@ -10,9 +10,9 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/mod v0.4.1 // indirect golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 rsc.io/binaryregexp v0.2.0 ) diff --git a/bigtable/go.sum b/bigtable/go.sum index 8b72d19d69e..1247e36a1f5 100644 --- a/bigtable/go.sum +++ b/bigtable/go.sum @@ -435,8 +435,8 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -535,8 +535,8 @@ google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/billing/apiv1/doc.go b/billing/apiv1/doc.go index 92b39824fe3..38c0995a338 100644 --- a/billing/apiv1/doc.go +++ b/billing/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/billing/budgets/apiv1/doc.go b/billing/budgets/apiv1/doc.go index 2b6182f92a7..6e9a062925e 100644 --- a/billing/budgets/apiv1/doc.go +++ b/billing/budgets/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/billing/budgets/apiv1beta1/doc.go b/billing/budgets/apiv1beta1/doc.go index 0c45829993d..9daf1aa36b4 100644 --- a/billing/budgets/apiv1beta1/doc.go +++ b/billing/budgets/apiv1beta1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go b/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go new file mode 100644 index 00000000000..ee80816d5c9 --- /dev/null +++ b/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go @@ -0,0 +1,456 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package binaryauthorization + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + binaryauthorizationpb "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +var newBinauthzManagementServiceV1Beta1ClientHook clientHook + +// BinauthzManagementServiceV1Beta1CallOptions contains the retry settings for each method of BinauthzManagementServiceV1Beta1Client. +type BinauthzManagementServiceV1Beta1CallOptions struct { + GetPolicy []gax.CallOption + UpdatePolicy []gax.CallOption + CreateAttestor []gax.CallOption + GetAttestor []gax.CallOption + UpdateAttestor []gax.CallOption + ListAttestors []gax.CallOption + DeleteAttestor []gax.CallOption +} + +func defaultBinauthzManagementServiceV1Beta1ClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("binaryauthorization.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("binaryauthorization.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://binaryauthorization.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultBinauthzManagementServiceV1Beta1CallOptions() *BinauthzManagementServiceV1Beta1CallOptions { + return &BinauthzManagementServiceV1Beta1CallOptions{ + GetPolicy: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdatePolicy: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateAttestor: []gax.CallOption{}, + GetAttestor: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateAttestor: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListAttestors: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeleteAttestor: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + } +} + +// BinauthzManagementServiceV1Beta1Client is a client for interacting with Binary Authorization API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type BinauthzManagementServiceV1Beta1Client struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // The gRPC API client. + binauthzManagementServiceV1Beta1Client binaryauthorizationpb.BinauthzManagementServiceV1Beta1Client + + // The call options for this service. + CallOptions *BinauthzManagementServiceV1Beta1CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewBinauthzManagementServiceV1Beta1Client creates a new binauthz management service v1 beta1 client. +// +// Google Cloud Management Service for Binary Authorization admission policies +// and attestation authorities. +// +// This API implements a REST model with the following objects: +// +// Policy +// +// Attestor +func NewBinauthzManagementServiceV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*BinauthzManagementServiceV1Beta1Client, error) { + clientOpts := defaultBinauthzManagementServiceV1Beta1ClientOptions() + + if newBinauthzManagementServiceV1Beta1ClientHook != nil { + hookOpts, err := newBinauthzManagementServiceV1Beta1ClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &BinauthzManagementServiceV1Beta1Client{ + connPool: connPool, + disableDeadlines: disableDeadlines, + CallOptions: defaultBinauthzManagementServiceV1Beta1CallOptions(), + + binauthzManagementServiceV1Beta1Client: binaryauthorizationpb.NewBinauthzManagementServiceV1Beta1Client(connPool), + } + c.setGoogleClientInfo() + + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *BinauthzManagementServiceV1Beta1Client) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *BinauthzManagementServiceV1Beta1Client) Close() error { + return c.connPool.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *BinauthzManagementServiceV1Beta1Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// GetPolicy a policy specifies the attestors that must attest to +// a container image, before the project is allowed to deploy that +// image. There is at most one policy per project. All image admission +// requests are permitted if a project has no policy. +// +// Gets the policy for this project. Returns a default +// policy if the project does not have one. +func (c *BinauthzManagementServiceV1Beta1Client) GetPolicy(ctx context.Context, req *binaryauthorizationpb.GetPolicyRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Policy, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 600000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetPolicy[0:len(c.CallOptions.GetPolicy):len(c.CallOptions.GetPolicy)], opts...) + var resp *binaryauthorizationpb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.binauthzManagementServiceV1Beta1Client.GetPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdatePolicy creates or updates a project’s policy, and returns a copy of the +// new policy. A policy is always updated as a whole, to avoid race +// conditions with concurrent policy enforcement (or management!) +// requests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT +// if the request is malformed. +func (c *BinauthzManagementServiceV1Beta1Client) UpdatePolicy(ctx context.Context, req *binaryauthorizationpb.UpdatePolicyRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Policy, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 600000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "policy.name", url.QueryEscape(req.GetPolicy().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdatePolicy[0:len(c.CallOptions.UpdatePolicy):len(c.CallOptions.UpdatePolicy)], opts...) + var resp *binaryauthorizationpb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.binauthzManagementServiceV1Beta1Client.UpdatePolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateAttestor creates an attestor, and returns a copy of the new +// attestor. Returns NOT_FOUND if the project does not exist, +// INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the +// attestor already exists. +func (c *BinauthzManagementServiceV1Beta1Client) CreateAttestor(ctx context.Context, req *binaryauthorizationpb.CreateAttestorRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Attestor, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 600000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateAttestor[0:len(c.CallOptions.CreateAttestor):len(c.CallOptions.CreateAttestor)], opts...) + var resp *binaryauthorizationpb.Attestor + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.binauthzManagementServiceV1Beta1Client.CreateAttestor(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetAttestor gets an attestor. +// Returns NOT_FOUND if the attestor does not exist. +func (c *BinauthzManagementServiceV1Beta1Client) GetAttestor(ctx context.Context, req *binaryauthorizationpb.GetAttestorRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Attestor, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 600000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetAttestor[0:len(c.CallOptions.GetAttestor):len(c.CallOptions.GetAttestor)], opts...) + var resp *binaryauthorizationpb.Attestor + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.binauthzManagementServiceV1Beta1Client.GetAttestor(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateAttestor updates an attestor. +// Returns NOT_FOUND if the attestor does not exist. +func (c *BinauthzManagementServiceV1Beta1Client) UpdateAttestor(ctx context.Context, req *binaryauthorizationpb.UpdateAttestorRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Attestor, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 600000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "attestor.name", url.QueryEscape(req.GetAttestor().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateAttestor[0:len(c.CallOptions.UpdateAttestor):len(c.CallOptions.UpdateAttestor)], opts...) + var resp *binaryauthorizationpb.Attestor + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.binauthzManagementServiceV1Beta1Client.UpdateAttestor(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListAttestors lists attestors. +// Returns INVALID_ARGUMENT if the project does not exist. +func (c *BinauthzManagementServiceV1Beta1Client) ListAttestors(ctx context.Context, req *binaryauthorizationpb.ListAttestorsRequest, opts ...gax.CallOption) *AttestorIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListAttestors[0:len(c.CallOptions.ListAttestors):len(c.CallOptions.ListAttestors)], opts...) + it := &AttestorIterator{} + req = proto.Clone(req).(*binaryauthorizationpb.ListAttestorsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*binaryauthorizationpb.Attestor, string, error) { + var resp *binaryauthorizationpb.ListAttestorsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.binauthzManagementServiceV1Beta1Client.ListAttestors(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetAttestors(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// DeleteAttestor deletes an attestor. Returns NOT_FOUND if the +// attestor does not exist. +func (c *BinauthzManagementServiceV1Beta1Client) DeleteAttestor(ctx context.Context, req *binaryauthorizationpb.DeleteAttestorRequest, opts ...gax.CallOption) error { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 600000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteAttestor[0:len(c.CallOptions.DeleteAttestor):len(c.CallOptions.DeleteAttestor)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.binauthzManagementServiceV1Beta1Client.DeleteAttestor(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// AttestorIterator manages a stream of *binaryauthorizationpb.Attestor. +type AttestorIterator struct { + items []*binaryauthorizationpb.Attestor + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*binaryauthorizationpb.Attestor, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *AttestorIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *AttestorIterator) Next() (*binaryauthorizationpb.Attestor, error) { + var item *binaryauthorizationpb.Attestor + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *AttestorIterator) bufLen() int { + return len(it.items) +} + +func (it *AttestorIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client_example_test.go b/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client_example_test.go new file mode 100644 index 00000000000..a691917b4a9 --- /dev/null +++ b/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client_example_test.go @@ -0,0 +1,178 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package binaryauthorization_test + +import ( + "context" + + binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1beta1" + "google.golang.org/api/iterator" + binaryauthorizationpb "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1" +) + +func ExampleNewBinauthzManagementServiceV1Beta1Client() { + ctx := context.Background() + c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleBinauthzManagementServiceV1Beta1Client_GetPolicy() { + // import binaryauthorizationpb "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1" + + ctx := context.Background() + c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &binaryauthorizationpb.GetPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBinauthzManagementServiceV1Beta1Client_UpdatePolicy() { + // import binaryauthorizationpb "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1" + + ctx := context.Background() + c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &binaryauthorizationpb.UpdatePolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdatePolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBinauthzManagementServiceV1Beta1Client_CreateAttestor() { + // import binaryauthorizationpb "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1" + + ctx := context.Background() + c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &binaryauthorizationpb.CreateAttestorRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateAttestor(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBinauthzManagementServiceV1Beta1Client_GetAttestor() { + // import binaryauthorizationpb "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1" + + ctx := context.Background() + c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &binaryauthorizationpb.GetAttestorRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetAttestor(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBinauthzManagementServiceV1Beta1Client_UpdateAttestor() { + // import binaryauthorizationpb "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1" + + ctx := context.Background() + c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &binaryauthorizationpb.UpdateAttestorRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateAttestor(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBinauthzManagementServiceV1Beta1Client_ListAttestors() { + // import binaryauthorizationpb "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &binaryauthorizationpb.ListAttestorsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListAttestors(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleBinauthzManagementServiceV1Beta1Client_DeleteAttestor() { + ctx := context.Background() + c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &binaryauthorizationpb.DeleteAttestorRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteAttestor(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/binaryauthorization/apiv1beta1/doc.go b/binaryauthorization/apiv1beta1/doc.go new file mode 100644 index 00000000000..99b9493f958 --- /dev/null +++ b/binaryauthorization/apiv1beta1/doc.go @@ -0,0 +1,117 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +// Package binaryauthorization is an auto-generated package for the +// Binary Authorization API. +// +// The management interface for Binary Authorization, a system providing +// policy control for images deployed to Kubernetes Engine clusters. +// +// Use of Context +// +// The ctx passed to NewClient is used for authentication requests and +// for creating the underlying connection, but is not used for subsequent calls. +// Individual methods on the client use the ctx given to them. +// +// To close the open connection, use the Close() method. +// +// For information about setting deadlines, reusing contexts, and more +// please visit pkg.go.dev/cloud.google.com/go. +package binaryauthorization // import "cloud.google.com/go/binaryauthorization/apiv1beta1" + +import ( + "context" + "os" + "runtime" + "strconv" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +const versionClient = "20210114" + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +func checkDisableDeadlines() (bool, error) { + raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") + if !ok { + return false, nil + } + + b, err := strconv.ParseBool(raw) + return b, err +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/channel/apiv1/doc.go b/channel/apiv1/doc.go index 0471a321989..a18123efb92 100644 --- a/channel/apiv1/doc.go +++ b/channel/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go index 7d73e76de2a..6bfa2447761 100644 --- a/cloudbuild/apiv1/v2/doc.go +++ b/cloudbuild/apiv1/v2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go index d32c0ff4bcc..1eeb0ebd374 100644 --- a/cloudtasks/apiv2/doc.go +++ b/cloudtasks/apiv2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go index 6fd2a7d003d..4c87d63ad1d 100644 --- a/cloudtasks/apiv2beta2/doc.go +++ b/cloudtasks/apiv2beta2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2beta3/doc.go b/cloudtasks/apiv2beta3/doc.go index 9eaf96f7b4b..dde5b0d73af 100644 --- a/cloudtasks/apiv2beta3/doc.go +++ b/cloudtasks/apiv2beta3/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/container/apiv1/doc.go b/container/apiv1/doc.go index 67a7e6af830..9b3566dc676 100644 --- a/container/apiv1/doc.go +++ b/container/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/containeranalysis/apiv1beta1/doc.go b/containeranalysis/apiv1beta1/doc.go index 62533b75543..86c0fee374d 100644 --- a/containeranalysis/apiv1beta1/doc.go +++ b/containeranalysis/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1/doc.go b/datacatalog/apiv1/doc.go index 4b62be499cc..6b6a3fbc39b 100644 --- a/datacatalog/apiv1/doc.go +++ b/datacatalog/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1beta1/doc.go b/datacatalog/apiv1beta1/doc.go index 9411fa64e4e..8eeed360202 100644 --- a/datacatalog/apiv1beta1/doc.go +++ b/datacatalog/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1/doc.go b/dataproc/apiv1/doc.go index caee35d378f..94f35b211c3 100644 --- a/dataproc/apiv1/doc.go +++ b/dataproc/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1beta2/doc.go b/dataproc/apiv1beta2/doc.go index 302a3d1a9b3..d93be0bc154 100644 --- a/dataproc/apiv1beta2/doc.go +++ b/dataproc/apiv1beta2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastore/CHANGES.md b/datastore/CHANGES.md index 61b9812cd5b..caf8d9333a7 100644 --- a/datastore/CHANGES.md +++ b/datastore/CHANGES.md @@ -1,5 +1,20 @@ # Changes +## [1.4.0](https://www.github.com/googleapis/google-cloud-go/compare/datastore/v1.3.0...v1.4.0) (2021-01-15) + + +### Features + +* **datastore:** add opencensus tracing/stats support ([#2804](https://www.github.com/googleapis/google-cloud-go/issues/2804)) ([5e6c350](https://www.github.com/googleapis/google-cloud-go/commit/5e6c350b2ac94787934380e930af2cb2094fa8f1)) +* **datastore:** support civil package types save ([#3202](https://www.github.com/googleapis/google-cloud-go/issues/3202)) ([9cc1a66](https://www.github.com/googleapis/google-cloud-go/commit/9cc1a66e22ecd8dcad1235c290f05b92edff5aa0)) + + +### Bug Fixes + +* **datastore:** Ensure the datastore time is returned as UTC ([#3521](https://www.github.com/googleapis/google-cloud-go/issues/3521)) ([0e659e2](https://www.github.com/googleapis/google-cloud-go/commit/0e659e28da503b9520c83eb136df6e54d6c6daf7)) +* **datastore:** increase deferred key iter limit ([#2878](https://www.github.com/googleapis/google-cloud-go/issues/2878)) ([7f1057a](https://www.github.com/googleapis/google-cloud-go/commit/7f1057a30d3b8691a22c85255bb41d31d42c6f9c)) +* **datastore:** loading civil types in non UTC location is incorrect ([#3376](https://www.github.com/googleapis/google-cloud-go/issues/3376)) ([9ac287d](https://www.github.com/googleapis/google-cloud-go/commit/9ac287d2abfb6bdcdceabb67fa0d93fb7b0dd863)) + ## v1.3.0 - Fix saving behavior for non-struct custom types which implement `PropertyLoadSaver` and for nil interface types. diff --git a/datastore/admin/apiv1/doc.go b/datastore/admin/apiv1/doc.go index c6db0ac451e..010429e6b05 100644 --- a/datastore/admin/apiv1/doc.go +++ b/datastore/admin/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastore/go.mod b/datastore/go.mod index 93e3153a4e5..cf561184940 100644 --- a/datastore/go.mod +++ b/datastore/go.mod @@ -9,9 +9,9 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/mod v0.4.1 // indirect golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 // indirect - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 google.golang.org/protobuf v1.25.0 ) diff --git a/datastore/go.sum b/datastore/go.sum index ed69e8ddcaa..faed76fcbdc 100644 --- a/datastore/go.sum +++ b/datastore/go.sum @@ -430,8 +430,8 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -529,8 +529,8 @@ google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go index 5aaf6cf680e..f5978749747 100644 --- a/debugger/apiv2/doc.go +++ b/debugger/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go index 1fb42e33c2c..77934a15d7d 100644 --- a/dialogflow/apiv2/doc.go +++ b/dialogflow/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/cx/apiv3beta1/doc.go b/dialogflow/cx/apiv3beta1/doc.go index c1a3845d09d..c3a7c270350 100644 --- a/dialogflow/cx/apiv3beta1/doc.go +++ b/dialogflow/cx/apiv3beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go index 04e9d33cc54..5e7b2a53f66 100644 --- a/dlp/apiv2/doc.go +++ b/dlp/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/errorreporting/apiv1beta1/doc.go b/errorreporting/apiv1beta1/doc.go index 02fe7d6439e..9e8668280fb 100644 --- a/errorreporting/apiv1beta1/doc.go +++ b/errorreporting/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/apiv1/admin/doc.go b/firestore/apiv1/admin/doc.go index 9099472c025..01963eaa05c 100644 --- a/firestore/apiv1/admin/doc.go +++ b/firestore/apiv1/admin/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/apiv1/doc.go b/firestore/apiv1/doc.go index 3eea3864d77..c78798d08f4 100644 --- a/firestore/apiv1/doc.go +++ b/firestore/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/go.mod b/firestore/go.mod index a3acf0d8206..5d6a4abef50 100644 --- a/firestore/go.mod +++ b/firestore/go.mod @@ -9,8 +9,8 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/mod v0.4.1 // indirect golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 // indirect - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 ) diff --git a/firestore/go.sum b/firestore/go.sum index 32fd17f1419..bc9ee23c74d 100644 --- a/firestore/go.sum +++ b/firestore/go.sum @@ -432,8 +432,8 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -501,8 +501,8 @@ google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/functions/apiv1/doc.go b/functions/apiv1/doc.go index 0357d2124b4..9b77516d711 100644 --- a/functions/apiv1/doc.go +++ b/functions/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gaming/apiv1/doc.go b/gaming/apiv1/doc.go index 61013e0e6b0..263f1c22c0c 100644 --- a/gaming/apiv1/doc.go +++ b/gaming/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gaming/apiv1beta/doc.go b/gaming/apiv1beta/doc.go index ca1097608ab..0aa0760e0e7 100644 --- a/gaming/apiv1beta/doc.go +++ b/gaming/apiv1beta/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/go.mod b/go.mod index 62b01cd80aa..219fa9233ef 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( golang.org/x/net v0.0.0-20201224014010-6772e930b67b golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 golang.org/x/text v0.3.5 - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 ) diff --git a/go.sum b/go.sum index 63df7122593..7d2a56fca7a 100644 --- a/go.sum +++ b/go.sum @@ -419,8 +419,8 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -508,8 +508,8 @@ google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go index 1f3f4802622..9fa53219147 100644 --- a/iam/credentials/apiv1/doc.go +++ b/iam/credentials/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/internal/.repo-metadata-full.json b/internal/.repo-metadata-full.json index e4df692741a..f94be2c8851 100644 --- a/internal/.repo-metadata-full.json +++ b/internal/.repo-metadata-full.json @@ -207,6 +207,14 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/billing/budgets/apiv1beta1", "release_level": "beta" }, + "cloud.google.com/go/binaryauthorization/apiv1beta1": { + "distribution_name": "cloud.google.com/go/binaryauthorization/apiv1beta1", + "description": "Binary Authorization API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1beta1", + "release_level": "beta" + }, "cloud.google.com/go/channel/apiv1": { "distribution_name": "cloud.google.com/go/channel/apiv1", "description": "Cloud Channel API", @@ -663,6 +671,14 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/redis/apiv1beta1", "release_level": "beta" }, + "cloud.google.com/go/resourcemanager/apiv2": { + "distribution_name": "cloud.google.com/go/resourcemanager/apiv2", + "description": "Cloud Resource Manager API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/resourcemanager/apiv2", + "release_level": "beta" + }, "cloud.google.com/go/retail/apiv2": { "distribution_name": "cloud.google.com/go/retail/apiv2", "description": "Retail API", diff --git a/internal/examples/fake/go.mod b/internal/examples/fake/go.mod index a89ac49c777..64050ef3f97 100644 --- a/internal/examples/fake/go.mod +++ b/internal/examples/fake/go.mod @@ -7,6 +7,6 @@ require ( golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 // indirect google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.33.2 ) diff --git a/internal/examples/fake/go.sum b/internal/examples/fake/go.sum index 4c008fd197d..3274dfde86f 100644 --- a/internal/examples/fake/go.sum +++ b/internal/examples/fake/go.sum @@ -376,8 +376,8 @@ google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/examples/mock/go.mod b/internal/examples/mock/go.mod index 5af8f17133e..e3bde58bdfc 100644 --- a/internal/examples/mock/go.mod +++ b/internal/examples/mock/go.mod @@ -10,6 +10,6 @@ require ( golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3 // indirect golang.org/x/text v0.3.4 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.33.2 // indirect ) diff --git a/internal/examples/mock/go.sum b/internal/examples/mock/go.sum index ffa20ee5a22..c4f749ea760 100644 --- a/internal/examples/mock/go.sum +++ b/internal/examples/mock/go.sum @@ -77,8 +77,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go index 030371efb5e..dfffb1fae69 100644 --- a/internal/gapicgen/generator/config.go +++ b/internal/gapicgen/generator/config.go @@ -879,7 +879,16 @@ var microgenGapicConfigs = []*microgenConfig{ pkg: "appengine", importPath: "cloud.google.com/go/appengine/apiv1", apiServiceConfigPath: "google/appengine/v1/appengine.yaml", - releaseLevel: "beta", + // GA after 2021/02/13 + releaseLevel: "beta", + }, + { + inputDirectoryPath: "google/cloud/binaryauthorization/v1beta1", + pkg: "binaryauthorization", + importPath: "cloud.google.com/go/binaryauthorization/apiv1beta1", + gRPCServiceConfigPath: "google/cloud/binaryauthorization/v1beta1/binaryauthorization_grpc_service_config.json", + apiServiceConfigPath: "google/cloud/binaryauthorization/v1beta1/binaryauthorization_v1beta1.yaml", + releaseLevel: "beta", }, { inputDirectoryPath: "google/cloud/channel/v1", @@ -890,6 +899,14 @@ var microgenGapicConfigs = []*microgenConfig{ // GA after 2021/02/08 releaseLevel: "beta", }, + { + inputDirectoryPath: "google/cloud/resourcemanager/v2", + pkg: "resourcemanager", + importPath: "cloud.google.com/go/resourcemanager/apiv2", + apiServiceConfigPath: "google/cloud/resourcemanager/v2/cloudresourcemanager_v2.yaml", + // GA after 2021/02/19 + releaseLevel: "beta", + }, // Non-Cloud APIs { diff --git a/internal/godocfx/go.mod b/internal/godocfx/go.mod index c5cfbf61e10..19142d15a3d 100644 --- a/internal/godocfx/go.mod +++ b/internal/godocfx/go.mod @@ -8,7 +8,7 @@ require ( cloud.google.com/go/datastore v1.1.0 cloud.google.com/go/storage v1.11.0 github.com/kr/pretty v0.2.1 // indirect - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index 1a52742f32a..facce1675a7 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -250,8 +250,8 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200827163409-021d7c6f1ec3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -304,8 +304,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200827165113-ac2560b5e952/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/iot/apiv1/doc.go b/iot/apiv1/doc.go index de2d2ec1582..6729a01c0dd 100644 --- a/iot/apiv1/doc.go +++ b/iot/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/kms/apiv1/doc.go b/kms/apiv1/doc.go index 74dadbb9699..825076bfee0 100644 --- a/kms/apiv1/doc.go +++ b/kms/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1/doc.go b/language/apiv1/doc.go index a7fdcbf74f0..bdbd5e9f4db 100644 --- a/language/apiv1/doc.go +++ b/language/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1beta2/doc.go b/language/apiv1beta2/doc.go index ef1d35e359a..d5e387a1e5f 100644 --- a/language/apiv1beta2/doc.go +++ b/language/apiv1beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/logging/apiv2/doc.go b/logging/apiv2/doc.go index f8bde2c49e0..fd45633b09d 100644 --- a/logging/apiv2/doc.go +++ b/logging/apiv2/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/logging/go.mod b/logging/go.mod index affb70e91b9..04a8f2e4538 100644 --- a/logging/go.mod +++ b/logging/go.mod @@ -11,8 +11,8 @@ require ( go.opencensus.io v0.22.5 golang.org/x/mod v0.4.1 // indirect golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 ) diff --git a/logging/go.sum b/logging/go.sum index 91035ac2903..e1171beb4be 100644 --- a/logging/go.sum +++ b/logging/go.sum @@ -438,8 +438,8 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -507,8 +507,8 @@ google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go index beb2c93aa7b..b87ae99f2a4 100644 --- a/longrunning/autogen/doc.go +++ b/longrunning/autogen/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/managedidentities/apiv1/doc.go b/managedidentities/apiv1/doc.go index 9b639b6a8ce..69fcfb4268a 100644 --- a/managedidentities/apiv1/doc.go +++ b/managedidentities/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/memcache/apiv1beta2/doc.go b/memcache/apiv1beta2/doc.go index c3816d88e05..09a4031c427 100644 --- a/memcache/apiv1beta2/doc.go +++ b/memcache/apiv1beta2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/apiv3/v2/doc.go b/monitoring/apiv3/v2/doc.go index d802c113716..d344991369c 100644 --- a/monitoring/apiv3/v2/doc.go +++ b/monitoring/apiv3/v2/doc.go @@ -53,7 +53,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/dashboard/apiv1/doc.go b/monitoring/dashboard/apiv1/doc.go index 9faf59a50b4..f7192858e29 100644 --- a/monitoring/dashboard/apiv1/doc.go +++ b/monitoring/dashboard/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/notebooks/apiv1beta1/doc.go b/notebooks/apiv1beta1/doc.go index 6aa9b6a0fc0..4b7cfe044f4 100644 --- a/notebooks/apiv1beta1/doc.go +++ b/notebooks/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/agentendpoint/apiv1/doc.go b/osconfig/agentendpoint/apiv1/doc.go index 689d0c21f04..5eae91fe6c1 100644 --- a/osconfig/agentendpoint/apiv1/doc.go +++ b/osconfig/agentendpoint/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/agentendpoint/apiv1beta/doc.go b/osconfig/agentendpoint/apiv1beta/doc.go index fe70c452b58..4b715185d56 100644 --- a/osconfig/agentendpoint/apiv1beta/doc.go +++ b/osconfig/agentendpoint/apiv1beta/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1/doc.go b/osconfig/apiv1/doc.go index ce7f3f7e490..9541410f7fd 100644 --- a/osconfig/apiv1/doc.go +++ b/osconfig/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1beta/doc.go b/osconfig/apiv1beta/doc.go index 9fbce3730a9..55729374ab7 100644 --- a/osconfig/apiv1beta/doc.go +++ b/osconfig/apiv1beta/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/oslogin/apiv1/doc.go b/oslogin/apiv1/doc.go index 7e0b96a9a68..d9ed72cd80d 100644 --- a/oslogin/apiv1/doc.go +++ b/oslogin/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/oslogin/apiv1beta/doc.go b/oslogin/apiv1beta/doc.go index 5b56d68f556..5bd4e81fe72 100644 --- a/oslogin/apiv1beta/doc.go +++ b/oslogin/apiv1beta/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/phishingprotection/apiv1beta1/doc.go b/phishingprotection/apiv1beta1/doc.go index 0d970832482..e44123602eb 100644 --- a/phishingprotection/apiv1beta1/doc.go +++ b/phishingprotection/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/policytroubleshooter/apiv1/doc.go b/policytroubleshooter/apiv1/doc.go index aec292e0bcc..4a07c6076cb 100644 --- a/policytroubleshooter/apiv1/doc.go +++ b/policytroubleshooter/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go index 4f39f97bf2b..6e6c31ef234 100644 --- a/pubsub/apiv1/doc.go +++ b/pubsub/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsub/go.mod b/pubsub/go.mod index dceada5485a..73a691d1b29 100644 --- a/pubsub/go.mod +++ b/pubsub/go.mod @@ -12,8 +12,8 @@ require ( golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 golang.org/x/sync v0.0.0-20201207232520-09787c993a3a golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 ) diff --git a/pubsub/go.sum b/pubsub/go.sum index bb81fc163ff..6205db11721 100644 --- a/pubsub/go.sum +++ b/pubsub/go.sum @@ -373,8 +373,8 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -440,8 +440,8 @@ google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsublite/README.md b/pubsublite/README.md index 137f0a3f746..746f5b72ac6 100644 --- a/pubsublite/README.md +++ b/pubsublite/README.md @@ -14,7 +14,7 @@ ```go import ( "cloud.google.com/go/pubsub" - "cloud.google.com/go/pubsublite/ps" + "cloud.google.com/go/pubsublite/pscompat" ) ``` @@ -25,7 +25,7 @@ To publish messages to a topic: // Create a PublisherClient for topic1 in zone us-central1-b. // See https://cloud.google.com/pubsub/lite/docs/locations for available zones. const topic = "projects/project-id/locations/us-central1-b/topics/topic1" -publisher, err := ps.NewPublisherClient(ctx, topic) +publisher, err := pscompat.NewPublisherClient(ctx, topic) if err != nil { log.Fatal(err) } @@ -49,7 +49,7 @@ To receive messages for a subscription: ```go // Create a SubscriberClient for subscription1 in zone us-central1-b. const subscription = "projects/project-id/locations/us-central1-b/subscriptions/subscription1" -subscriber, err := ps.NewSubscriberClient(ctx, subscription) +subscriber, err := pscompat.NewSubscriberClient(ctx, subscription) if err != nil { log.Fatal(err) } diff --git a/pubsublite/admin.go b/pubsublite/admin.go index 0a58a7c7fbd..8c548d3c41d 100644 --- a/pubsublite/admin.go +++ b/pubsublite/admin.go @@ -110,9 +110,10 @@ func (ac *AdminClient) Topic(ctx context.Context, topic string) (*TopicConfig, e return protoToTopicConfig(topicpb) } -// TopicPartitions returns the number of partitions for a topic. A valid topic -// path has the format: "projects/PROJECT_ID/locations/ZONE/topics/TOPIC_ID". -func (ac *AdminClient) TopicPartitions(ctx context.Context, topic string) (int, error) { +// TopicPartitionCount returns the number of partitions for a topic. A valid +// topic path has the format: +// "projects/PROJECT_ID/locations/ZONE/topics/TOPIC_ID". +func (ac *AdminClient) TopicPartitionCount(ctx context.Context, topic string) (int, error) { if _, err := wire.ParseTopicPath(topic); err != nil { return 0, err } diff --git a/pubsublite/admin_test.go b/pubsublite/admin_test.go index 8a63305073f..7784b9ca5fc 100644 --- a/pubsublite/admin_test.go +++ b/pubsublite/admin_test.go @@ -108,10 +108,10 @@ func TestAdminTopicCRUD(t *testing.T) { t.Errorf("Topic() got: %v\nwant: %v", gotConfig, topicConfig) } - if gotPartitions, err := admin.TopicPartitions(ctx, topicPath); err != nil { - t.Errorf("TopicPartitions() got err: %v", err) + if gotPartitions, err := admin.TopicPartitionCount(ctx, topicPath); err != nil { + t.Errorf("TopicPartitionCount() got err: %v", err) } else if wantPartitions := 3; gotPartitions != wantPartitions { - t.Errorf("TopicPartitions() got: %v\nwant: %v", gotPartitions, wantPartitions) + t.Errorf("TopicPartitionCount() got: %v\nwant: %v", gotPartitions, wantPartitions) } if err := admin.DeleteTopic(ctx, topicPath); err != nil { @@ -397,8 +397,8 @@ func TestAdminValidateResourcePaths(t *testing.T) { if _, err := admin.Topic(ctx, "INVALID"); err == nil { t.Errorf("Topic() should fail") } - if _, err := admin.TopicPartitions(ctx, "INVALID"); err == nil { - t.Errorf("TopicPartitions() should fail") + if _, err := admin.TopicPartitionCount(ctx, "INVALID"); err == nil { + t.Errorf("TopicPartitionCount() should fail") } if err := admin.DeleteTopic(ctx, "INVALID"); err == nil { t.Errorf("DeleteTopic() should fail") diff --git a/pubsublite/apiv1/doc.go b/pubsublite/apiv1/doc.go index 44a9d491f6a..f451b108b80 100644 --- a/pubsublite/apiv1/doc.go +++ b/pubsublite/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsublite/doc.go b/pubsublite/doc.go index 499fad2161b..a68788ec23d 100644 --- a/pubsublite/doc.go +++ b/pubsublite/doc.go @@ -67,17 +67,17 @@ and zones where Pub/Sub Lite is available. Publishing -The pubsublite/ps subpackage contains clients for publishing and receiving -messages, which have similar interfaces to their Topic and Subscription -counterparts in the Cloud Pub/Sub library: +The pubsublite/pscompat subpackage contains clients for publishing and receiving +messages, which have similar interfaces to their pubsub.Topic and +pubsub.Subscription counterparts in the Cloud Pub/Sub library: https://pkg.go.dev/cloud.google.com/go/pubsub. Pub/Sub Lite uses gRPC streams extensively for high throughput. For more -differences, see https://pkg.go.dev/cloud.google.com/go/pubsublite/ps. +differences, see https://pkg.go.dev/cloud.google.com/go/pubsublite/pscompat. To publish messages to a topic, first create a PublisherClient: - publisher, err := ps.NewPublisherClient(ctx, topicPath) + publisher, err := pscompat.NewPublisherClient(ctx, topicPath) if err != nil { // TODO: Handle error. } @@ -136,7 +136,7 @@ Receiving To receive messages for a subscription, first create a SubscriberClient: - subscriber, err := ps.NewSubscriberClient(ctx, subscriptionPath) + subscriber, err := pscompat.NewSubscriberClient(ctx, ubscriptionPath) Messages are then consumed from a subscription via callback. diff --git a/pubsublite/go.mod b/pubsublite/go.mod index 53d414c2b8d..e0f3769862f 100644 --- a/pubsublite/go.mod +++ b/pubsublite/go.mod @@ -12,10 +12,10 @@ require ( golang.org/x/mod v0.4.1 // indirect golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 // indirect golang.org/x/sync v0.0.0-20201207232520-09787c993a3a - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 google.golang.org/protobuf v1.25.0 ) diff --git a/pubsublite/go.sum b/pubsublite/go.sum index 028ae684677..5b4d018efbb 100644 --- a/pubsublite/go.sum +++ b/pubsublite/go.sum @@ -340,8 +340,8 @@ golang.org/x/tools v0.0.0-20201202200335-bef1c476418a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201208233053-a543418bbed2 h1:vEtypaVub6UvKkiXZ2xx9QIvp9TL7sI7xp7vdi2kezA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -411,8 +411,8 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201203001206-6486ece9c497/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201209185603-f92720507ed4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsublite/integration_test.go b/pubsublite/integration_test.go index 2c8b5e633a8..c8032f8abfe 100644 --- a/pubsublite/integration_test.go +++ b/pubsublite/integration_test.go @@ -163,10 +163,10 @@ func TestIntegration_ResourceAdminOperations(t *testing.T) { t.Errorf("Topic() got: -, want: +\n%s", diff) } - if gotTopicPartitions, err := admin.TopicPartitions(ctx, topicPath); err != nil { + if gotTopicPartitions, err := admin.TopicPartitionCount(ctx, topicPath); err != nil { t.Errorf("Failed to get topic partitions: %v", err) } else if gotTopicPartitions != newTopicConfig.PartitionCount { - t.Errorf("TopicPartitions() got: %v, want: %v", gotTopicPartitions, newTopicConfig.PartitionCount) + t.Errorf("TopicPartitionCount() got: %v, want: %v", gotTopicPartitions, newTopicConfig.PartitionCount) } topicIt := admin.Topics(ctx, locationPath) diff --git a/pubsublite/ps/doc.go b/pubsublite/pscompat/doc.go similarity index 60% rename from pubsublite/ps/doc.go rename to pubsublite/pscompat/doc.go index f092bf9d243..ee5662bb485 100644 --- a/pubsublite/ps/doc.go +++ b/pubsublite/pscompat/doc.go @@ -12,35 +12,37 @@ // See the License for the specific language governing permissions and /* -Package ps contains clients for publishing and subscribing using the Google -Cloud Pub/Sub Lite service. +Package pscompat contains clients for publishing and subscribing using the +Pub/Sub Lite service. -If interfaces are defined, PublisherClient and SubscriberClient can be used as +The clients in this package are designed to compatible with the Cloud Pub/Sub +library: https://pkg.go.dev/cloud.google.com/go/pubsub. If interfaces are +defined by the client, PublisherClient and SubscriberClient can be used as substitutions for pubsub.Topic.Publish() and pubsub.Subscription.Receive(), respectively, from the pubsub package. -As noted in comments, the two services have some differences: +The Cloud Pub/Sub and Pub/Sub Lite services have some differences: - Pub/Sub Lite does not support NACK for messages. By default, this will terminate the SubscriberClient. A custom function can be provided for ReceiveSettings.NackHandler to handle NACKed messages. - - Pub/Sub Lite has no concept of ack deadlines. Subscribers must ACK or NACK + - Pub/Sub Lite has no concept of ACK deadlines. Subscribers must ACK or NACK every message received and can take as much time as they need to process the message. - - Pub/Sub Lite PublisherClients and SubscriberClients can terminate when an - unretryable error occurs. + - Pub/Sub Lite PublisherClients and SubscriberClients can fail permanently + when an unretryable error occurs. - Publishers and subscribers will be throttled if Pub/Sub Lite publish or subscribe throughput limits are exceeded. Thus publishing can be more sensitive to buffer overflow than Cloud Pub/Sub. - Pub/Sub Lite utilizes bidirectional gRPC streams extensively to maximize publish and subscribe throughput. -More information about Google Cloud Pub/Sub Lite is available at +More information about Pub/Sub Lite is available at https://cloud.google.com/pubsub/lite. -Information about choosing between Google Cloud Pub/Sub vs Pub/Sub Lite is -available at https://cloud.google.com/pubsub/docs/choosing-pubsub-or-lite. +Information about choosing between Cloud Pub/Sub vs Pub/Sub Lite is available at +https://cloud.google.com/pubsub/docs/choosing-pubsub-or-lite. -See https://godoc.org/cloud.google.com/go for authentication, timeouts, +See https://pkg.go.dev/cloud.google.com/go for authentication, timeouts, connection pooling and similar aspects of this package. */ -package ps // import "cloud.google.com/go/pubsublite/ps" +package pscompat // import "cloud.google.com/go/pubsublite/pscompat" diff --git a/pubsublite/ps/example_test.go b/pubsublite/pscompat/example_test.go similarity index 88% rename from pubsublite/ps/example_test.go rename to pubsublite/pscompat/example_test.go index 37d59790ae2..67a18c7f4d4 100644 --- a/pubsublite/ps/example_test.go +++ b/pubsublite/pscompat/example_test.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps_test +package pscompat_test import ( "context" @@ -19,13 +19,13 @@ import ( "time" "cloud.google.com/go/pubsub" - "cloud.google.com/go/pubsublite/ps" + "cloud.google.com/go/pubsublite/pscompat" ) func ExamplePublisherClient_Publish() { ctx := context.Background() const topic = "projects/my-project/locations/zone/topics/my-topic" - publisher, err := ps.NewPublisherClient(ctx, topic) + publisher, err := pscompat.NewPublisherClient(ctx, topic) if err != nil { // TODO: Handle error. } @@ -53,11 +53,11 @@ func ExamplePublisherClient_Publish() { func ExamplePublisherClient_Publish_batchingSettings() { ctx := context.Background() const topic = "projects/my-project/locations/zone/topics/my-topic" - settings := ps.DefaultPublishSettings + settings := pscompat.DefaultPublishSettings settings.DelayThreshold = 50 * time.Millisecond settings.CountThreshold = 200 settings.BufferedByteLimit = 5e8 - publisher, err := ps.NewPublisherClientWithSettings(ctx, topic, settings) + publisher, err := pscompat.NewPublisherClientWithSettings(ctx, topic, settings) if err != nil { // TODO: Handle error. } @@ -81,7 +81,7 @@ func ExamplePublisherClient_Publish_batchingSettings() { func ExamplePublisherClient_Error() { ctx := context.Background() const topic = "projects/my-project/locations/zone/topics/my-topic" - publisher, err := ps.NewPublisherClient(ctx, topic) + publisher, err := pscompat.NewPublisherClient(ctx, topic) if err != nil { // TODO: Handle error. } @@ -97,7 +97,7 @@ func ExamplePublisherClient_Error() { id, err := r.Get(ctx) if err != nil { // TODO: Handle error. - if err == ps.ErrPublisherStopped { + if err == pscompat.ErrPublisherStopped { fmt.Printf("Publisher client stopped due to error: %v\n", publisher.Error()) } } @@ -108,7 +108,7 @@ func ExamplePublisherClient_Error() { func ExampleSubscriberClient_Receive() { ctx := context.Background() const subscription = "projects/my-project/locations/zone/subscriptions/my-subscription" - subscriber, err := ps.NewSubscriberClient(ctx, subscription) + subscriber, err := pscompat.NewSubscriberClient(ctx, subscription) if err != nil { // TODO: Handle error. } @@ -134,10 +134,10 @@ func ExampleSubscriberClient_Receive() { func ExampleSubscriberClient_Receive_maxOutstanding() { ctx := context.Background() const subscription = "projects/my-project/locations/zone/subscriptions/my-subscription" - settings := ps.DefaultReceiveSettings + settings := pscompat.DefaultReceiveSettings settings.MaxOutstandingMessages = 5 settings.MaxOutstandingBytes = 10e6 - subscriber, err := ps.NewSubscriberClientWithSettings(ctx, subscription, settings) + subscriber, err := pscompat.NewSubscriberClientWithSettings(ctx, subscription, settings) if err != nil { // TODO: Handle error. } diff --git a/pubsublite/ps/integration_test.go b/pubsublite/pscompat/integration_test.go similarity index 99% rename from pubsublite/ps/integration_test.go rename to pubsublite/pscompat/integration_test.go index 89e37329293..eefae8a6209 100644 --- a/pubsublite/ps/integration_test.go +++ b/pubsublite/pscompat/integration_test.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps +package pscompat import ( "context" diff --git a/pubsublite/ps/message.go b/pubsublite/pscompat/message.go similarity index 99% rename from pubsublite/ps/message.go rename to pubsublite/pscompat/message.go index 011b4b303b2..69f764340c7 100644 --- a/pubsublite/ps/message.go +++ b/pubsublite/pscompat/message.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps +package pscompat import ( "encoding/base64" diff --git a/pubsublite/ps/message_test.go b/pubsublite/pscompat/message_test.go similarity index 99% rename from pubsublite/ps/message_test.go rename to pubsublite/pscompat/message_test.go index aec1838c7cb..5a44f7e886d 100644 --- a/pubsublite/ps/message_test.go +++ b/pubsublite/pscompat/message_test.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps +package pscompat import ( "log" diff --git a/pubsublite/ps/publisher.go b/pubsublite/pscompat/publisher.go similarity index 99% rename from pubsublite/ps/publisher.go rename to pubsublite/pscompat/publisher.go index d27ae5816f7..4527dff6af9 100644 --- a/pubsublite/ps/publisher.go +++ b/pubsublite/pscompat/publisher.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps +package pscompat import ( "context" diff --git a/pubsublite/ps/publisher_test.go b/pubsublite/pscompat/publisher_test.go similarity index 99% rename from pubsublite/ps/publisher_test.go rename to pubsublite/pscompat/publisher_test.go index 3629b636b69..88988ff31d0 100644 --- a/pubsublite/ps/publisher_test.go +++ b/pubsublite/pscompat/publisher_test.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps +package pscompat import ( "context" diff --git a/pubsublite/ps/settings.go b/pubsublite/pscompat/settings.go similarity index 97% rename from pubsublite/ps/settings.go rename to pubsublite/pscompat/settings.go index 6b463296724..3d3032ee27f 100644 --- a/pubsublite/ps/settings.go +++ b/pubsublite/pscompat/settings.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps +package pscompat import ( "time" @@ -135,12 +135,12 @@ func (s *PublishSettings) toWireSettings() wire.PublishSettings { return wireSettings } -// NackHandler is invoked when pubsub.Message.Nack() is called. Cloud Pub/Sub -// Lite does not have a concept of 'nack'. If the nack handler implementation -// returns nil, the message is acknowledged. If an error is returned, the +// NackHandler is invoked when pubsub.Message.Nack() is called. Pub/Sub Lite +// does not have a concept of 'nack'. If the nack handler implementation returns +// nil, the message is acknowledged. If an error is returned, the // SubscriberClient will consider this a fatal error and terminate. // -// In Cloud Pub/Sub Lite, only a single subscriber for a given subscription is +// In Pub/Sub Lite, only a single subscriber for a given subscription is // connected to any partition at a time, and there is no other client that may // be able to handle messages. type NackHandler func(*pubsub.Message) error diff --git a/pubsublite/ps/settings_test.go b/pubsublite/pscompat/settings_test.go similarity index 99% rename from pubsublite/ps/settings_test.go rename to pubsublite/pscompat/settings_test.go index 900af0efdcf..ea79377f439 100644 --- a/pubsublite/ps/settings_test.go +++ b/pubsublite/pscompat/settings_test.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps +package pscompat import ( "testing" diff --git a/pubsublite/ps/subscriber.go b/pubsublite/pscompat/subscriber.go similarity index 99% rename from pubsublite/ps/subscriber.go rename to pubsublite/pscompat/subscriber.go index 8b3cb621e3f..80f6100be4a 100644 --- a/pubsublite/ps/subscriber.go +++ b/pubsublite/pscompat/subscriber.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps +package pscompat import ( "context" diff --git a/pubsublite/ps/subscriber_test.go b/pubsublite/pscompat/subscriber_test.go similarity index 99% rename from pubsublite/ps/subscriber_test.go rename to pubsublite/pscompat/subscriber_test.go index 9a8ebdb5a04..36abe36736b 100644 --- a/pubsublite/ps/subscriber_test.go +++ b/pubsublite/pscompat/subscriber_test.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -package ps +package pscompat import ( "context" diff --git a/recaptchaenterprise/apiv1/doc.go b/recaptchaenterprise/apiv1/doc.go index 60af4f9096e..ad8403fb72c 100644 --- a/recaptchaenterprise/apiv1/doc.go +++ b/recaptchaenterprise/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recaptchaenterprise/apiv1beta1/doc.go b/recaptchaenterprise/apiv1beta1/doc.go index 720e265b9cf..fe82abfdaa7 100644 --- a/recaptchaenterprise/apiv1beta1/doc.go +++ b/recaptchaenterprise/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recommender/apiv1/doc.go b/recommender/apiv1/doc.go index 80d343a19e7..399f58e7517 100644 --- a/recommender/apiv1/doc.go +++ b/recommender/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recommender/apiv1beta1/doc.go b/recommender/apiv1beta1/doc.go index 313a812caaa..f87acee5655 100644 --- a/recommender/apiv1beta1/doc.go +++ b/recommender/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/redis/apiv1/doc.go b/redis/apiv1/doc.go index d6bfed3260a..a3f4dc881d3 100644 --- a/redis/apiv1/doc.go +++ b/redis/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/redis/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go index 19d31fc9d62..67a9c50a6b0 100644 --- a/redis/apiv1beta1/doc.go +++ b/redis/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/resourcemanager/apiv2/doc.go b/resourcemanager/apiv2/doc.go new file mode 100644 index 00000000000..ebd6592d60a --- /dev/null +++ b/resourcemanager/apiv2/doc.go @@ -0,0 +1,118 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +// Package resourcemanager is an auto-generated package for the +// Cloud Resource Manager API. +// +// Creates, reads, and updates metadata for Google Cloud Platform resource +// containers. +// +// Use of Context +// +// The ctx passed to NewClient is used for authentication requests and +// for creating the underlying connection, but is not used for subsequent calls. +// Individual methods on the client use the ctx given to them. +// +// To close the open connection, use the Close() method. +// +// For information about setting deadlines, reusing contexts, and more +// please visit pkg.go.dev/cloud.google.com/go. +package resourcemanager // import "cloud.google.com/go/resourcemanager/apiv2" + +import ( + "context" + "os" + "runtime" + "strconv" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +const versionClient = "20210119" + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +func checkDisableDeadlines() (bool, error) { + raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") + if !ok { + return false, nil + } + + b, err := strconv.ParseBool(raw) + return b, err +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/resourcemanager/apiv2/folders_client.go b/resourcemanager/apiv2/folders_client.go new file mode 100644 index 00000000000..ffa974041f3 --- /dev/null +++ b/resourcemanager/apiv2/folders_client.go @@ -0,0 +1,701 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package resourcemanager + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + iampb "google.golang.org/genproto/googleapis/iam/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +var newFoldersClientHook clientHook + +// FoldersCallOptions contains the retry settings for each method of FoldersClient. +type FoldersCallOptions struct { + ListFolders []gax.CallOption + SearchFolders []gax.CallOption + GetFolder []gax.CallOption + CreateFolder []gax.CallOption + UpdateFolder []gax.CallOption + MoveFolder []gax.CallOption + DeleteFolder []gax.CallOption + UndeleteFolder []gax.CallOption + GetIamPolicy []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +func defaultFoldersClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("cloudresourcemanager.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("cloudresourcemanager.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://cloudresourcemanager.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultFoldersCallOptions() *FoldersCallOptions { + return &FoldersCallOptions{ + ListFolders: []gax.CallOption{}, + SearchFolders: []gax.CallOption{}, + GetFolder: []gax.CallOption{}, + CreateFolder: []gax.CallOption{}, + UpdateFolder: []gax.CallOption{}, + MoveFolder: []gax.CallOption{}, + DeleteFolder: []gax.CallOption{}, + UndeleteFolder: []gax.CallOption{}, + GetIamPolicy: []gax.CallOption{}, + SetIamPolicy: []gax.CallOption{}, + TestIamPermissions: []gax.CallOption{}, + } +} + +// FoldersClient is a client for interacting with Cloud Resource Manager API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type FoldersClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // The gRPC API client. + foldersClient resourcemanagerpb.FoldersClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *FoldersCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewFoldersClient creates a new folders client. +// +// Manages Cloud Resource Folders. +// Cloud Resource Folders can be used to organize the resources under an +// organization and to control the IAM policies applied to groups of resources. +func NewFoldersClient(ctx context.Context, opts ...option.ClientOption) (*FoldersClient, error) { + clientOpts := defaultFoldersClientOptions() + + if newFoldersClientHook != nil { + hookOpts, err := newFoldersClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &FoldersClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + CallOptions: defaultFoldersCallOptions(), + + foldersClient: resourcemanagerpb.NewFoldersClient(connPool), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) + if err != nil { + // This error "should not happen", since we are just reusing old connection pool + // and never actually need to dial. + // If this does happen, we could leak connp. However, we cannot close conn: + // If the user invoked the constructor with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO: investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *FoldersClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *FoldersClient) Close() error { + return c.connPool.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *FoldersClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListFolders lists the Folders that are direct descendants of supplied parent resource. +// List provides a strongly consistent view of the Folders underneath +// the specified parent resource. +// List returns Folders sorted based upon the (ascending) lexical ordering +// of their display_name. +// The caller must have resourcemanager.folders.list permission on the +// identified parent. +func (c *FoldersClient) ListFolders(ctx context.Context, req *resourcemanagerpb.ListFoldersRequest, opts ...gax.CallOption) *FolderIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListFolders[0:len(c.CallOptions.ListFolders):len(c.CallOptions.ListFolders)], opts...) + it := &FolderIterator{} + req = proto.Clone(req).(*resourcemanagerpb.ListFoldersRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*resourcemanagerpb.Folder, string, error) { + var resp *resourcemanagerpb.ListFoldersResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.ListFolders(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetFolders(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// SearchFolders search for folders that match specific filter criteria. +// Search provides an eventually consistent view of the folders a user has +// access to which meet the specified filter criteria. +// +// This will only return folders on which the caller has the +// permission resourcemanager.folders.get. +func (c *FoldersClient) SearchFolders(ctx context.Context, req *resourcemanagerpb.SearchFoldersRequest, opts ...gax.CallOption) *FolderIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SearchFolders[0:len(c.CallOptions.SearchFolders):len(c.CallOptions.SearchFolders)], opts...) + it := &FolderIterator{} + req = proto.Clone(req).(*resourcemanagerpb.SearchFoldersRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*resourcemanagerpb.Folder, string, error) { + var resp *resourcemanagerpb.SearchFoldersResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.SearchFolders(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetFolders(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// GetFolder retrieves a Folder identified by the supplied resource name. +// Valid Folder resource names have the format folders/{folder_id} +// (for example, folders/1234). +// The caller must have resourcemanager.folders.get permission on the +// identified folder. +func (c *FoldersClient) GetFolder(ctx context.Context, req *resourcemanagerpb.GetFolderRequest, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetFolder[0:len(c.CallOptions.GetFolder):len(c.CallOptions.GetFolder)], opts...) + var resp *resourcemanagerpb.Folder + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.GetFolder(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateFolder creates a Folder in the resource hierarchy. +// Returns an Operation which can be used to track the progress of the +// folder creation workflow. +// Upon success the Operation.response field will be populated with the +// created Folder. +// +// In order to succeed, the addition of this new Folder must not violate +// the Folder naming, height or fanout constraints. +// +// The Folder’s display_name must be distinct from all other Folder’s that +// share its parent. +// +// The addition of the Folder must not cause the active Folder hierarchy +// to exceed a height of 4. Note, the full active + deleted Folder hierarchy +// is allowed to reach a height of 8; this provides additional headroom when +// moving folders that contain deleted folders. +// +// The addition of the Folder must not cause the total number of Folders +// under its parent to exceed 100. +// +// If the operation fails due to a folder constraint violation, some errors +// may be returned by the CreateFolder request, with status code +// FAILED_PRECONDITION and an error description. Other folder constraint +// violations will be communicated in the Operation, with the specific +// PreconditionFailure returned via the details list in the Operation.error +// field. +// +// The caller must have resourcemanager.folders.create permission on the +// identified parent. +func (c *FoldersClient) CreateFolder(ctx context.Context, req *resourcemanagerpb.CreateFolderRequest, opts ...gax.CallOption) (*CreateFolderOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateFolder[0:len(c.CallOptions.CreateFolder):len(c.CallOptions.CreateFolder)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.CreateFolder(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateFolderOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// UpdateFolder updates a Folder, changing its display_name. +// Changes to the folder display_name will be rejected if they violate either +// the display_name formatting rules or naming constraints described in +// the CreateFolder documentation. +// +// The Folder’s display name must start and end with a letter or digit, +// may contain letters, digits, spaces, hyphens and underscores and can be +// no longer than 30 characters. This is captured by the regular expression: +// [\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?. +// The caller must have resourcemanager.folders.update permission on the +// identified folder. +// +// If the update fails due to the unique name constraint then a +// PreconditionFailure explaining this violation will be returned +// in the Status.details field. +func (c *FoldersClient) UpdateFolder(ctx context.Context, req *resourcemanagerpb.UpdateFolderRequest, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "folder.name", url.QueryEscape(req.GetFolder().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateFolder[0:len(c.CallOptions.UpdateFolder):len(c.CallOptions.UpdateFolder)], opts...) + var resp *resourcemanagerpb.Folder + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.UpdateFolder(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// MoveFolder moves a Folder under a new resource parent. +// Returns an Operation which can be used to track the progress of the +// folder move workflow. +// Upon success the Operation.response field will be populated with the +// moved Folder. +// Upon failure, a FolderOperationError categorizing the failure cause will +// be returned - if the failure occurs synchronously then the +// FolderOperationError will be returned via the Status.details field +// and if it occurs asynchronously then the FolderOperation will be returned +// via the Operation.error field. +// In addition, the Operation.metadata field will be populated with a +// FolderOperation message as an aid to stateless clients. +// Folder moves will be rejected if they violate either the naming, height +// or fanout constraints described in the +// CreateFolder documentation. +// The caller must have resourcemanager.folders.move permission on the +// folder’s current and proposed new parent. +func (c *FoldersClient) MoveFolder(ctx context.Context, req *resourcemanagerpb.MoveFolderRequest, opts ...gax.CallOption) (*MoveFolderOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.MoveFolder[0:len(c.CallOptions.MoveFolder):len(c.CallOptions.MoveFolder)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.MoveFolder(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &MoveFolderOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DeleteFolder requests deletion of a Folder. The Folder is moved into the +// DELETE_REQUESTED state +// immediately, and is deleted approximately 30 days later. This method may +// only be called on an empty Folder in the +// [ACTIVE][google.cloud.resourcemanager.v2.Folder.LifecycleState.ACTIVE (at http://google.cloud.resourcemanager.v2.Folder.LifecycleState.ACTIVE)] state, where a Folder is empty if +// it doesn’t contain any Folders or Projects in the +// [ACTIVE][google.cloud.resourcemanager.v2.Folder.LifecycleState.ACTIVE (at http://google.cloud.resourcemanager.v2.Folder.LifecycleState.ACTIVE)] state. +// The caller must have resourcemanager.folders.delete permission on the +// identified folder. +func (c *FoldersClient) DeleteFolder(ctx context.Context, req *resourcemanagerpb.DeleteFolderRequest, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteFolder[0:len(c.CallOptions.DeleteFolder):len(c.CallOptions.DeleteFolder)], opts...) + var resp *resourcemanagerpb.Folder + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.DeleteFolder(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UndeleteFolder cancels the deletion request for a Folder. This method may only be +// called on a Folder in the +// DELETE_REQUESTED state. +// In order to succeed, the Folder’s parent must be in the +// [ACTIVE][google.cloud.resourcemanager.v2.Folder.LifecycleState.ACTIVE (at http://google.cloud.resourcemanager.v2.Folder.LifecycleState.ACTIVE)] state. +// In addition, reintroducing the folder into the tree must not violate +// folder naming, height and fanout constraints described in the +// CreateFolder documentation. +// The caller must have resourcemanager.folders.undelete permission on the +// identified folder. +func (c *FoldersClient) UndeleteFolder(ctx context.Context, req *resourcemanagerpb.UndeleteFolderRequest, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UndeleteFolder[0:len(c.CallOptions.UndeleteFolder):len(c.CallOptions.UndeleteFolder)], opts...) + var resp *resourcemanagerpb.Folder + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.UndeleteFolder(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetIamPolicy gets the access control policy for a Folder. The returned policy may be +// empty if no such policy or resource exists. The resource field should +// be the Folder’s resource name, e.g. “folders/1234”. +// The caller must have resourcemanager.folders.getIamPolicy permission +// on the identified folder. +func (c *FoldersClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetIamPolicy[0:len(c.CallOptions.GetIamPolicy):len(c.CallOptions.GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetIamPolicy sets the access control policy on a Folder, replacing any existing policy. +// The resource field should be the Folder’s resource name, e.g. +// “folders/1234”. +// The caller must have resourcemanager.folders.setIamPolicy permission +// on the identified folder. +func (c *FoldersClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.SetIamPolicy[0:len(c.CallOptions.SetIamPolicy):len(c.CallOptions.SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// TestIamPermissions returns permissions that a caller has on the specified Folder. +// The resource field should be the Folder’s resource name, +// e.g. “folders/1234”. +// +// There are no permissions required for making this API call. +func (c *FoldersClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.TestIamPermissions[0:len(c.CallOptions.TestIamPermissions):len(c.CallOptions.TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.foldersClient.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateFolderOperation manages a long-running operation from CreateFolder. +type CreateFolderOperation struct { + lro *longrunning.Operation +} + +// CreateFolderOperation returns a new CreateFolderOperation from a given name. +// The name must be that of a previously created CreateFolderOperation, possibly from a different process. +func (c *FoldersClient) CreateFolderOperation(name string) *CreateFolderOperation { + return &CreateFolderOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateFolderOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) { + var resp resourcemanagerpb.Folder + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateFolderOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) { + var resp resourcemanagerpb.Folder + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateFolderOperation) Metadata() (*resourcemanagerpb.FolderOperation, error) { + var meta resourcemanagerpb.FolderOperation + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateFolderOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateFolderOperation) Name() string { + return op.lro.Name() +} + +// MoveFolderOperation manages a long-running operation from MoveFolder. +type MoveFolderOperation struct { + lro *longrunning.Operation +} + +// MoveFolderOperation returns a new MoveFolderOperation from a given name. +// The name must be that of a previously created MoveFolderOperation, possibly from a different process. +func (c *FoldersClient) MoveFolderOperation(name string) *MoveFolderOperation { + return &MoveFolderOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *MoveFolderOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) { + var resp resourcemanagerpb.Folder + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *MoveFolderOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) { + var resp resourcemanagerpb.Folder + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *MoveFolderOperation) Metadata() (*resourcemanagerpb.FolderOperation, error) { + var meta resourcemanagerpb.FolderOperation + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *MoveFolderOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *MoveFolderOperation) Name() string { + return op.lro.Name() +} + +// FolderIterator manages a stream of *resourcemanagerpb.Folder. +type FolderIterator struct { + items []*resourcemanagerpb.Folder + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*resourcemanagerpb.Folder, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *FolderIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *FolderIterator) Next() (*resourcemanagerpb.Folder, error) { + var item *resourcemanagerpb.Folder + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *FolderIterator) bufLen() int { + return len(it.items) +} + +func (it *FolderIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/resourcemanager/apiv2/folders_client_example_test.go b/resourcemanager/apiv2/folders_client_example_test.go new file mode 100644 index 00000000000..bb6b652cd05 --- /dev/null +++ b/resourcemanager/apiv2/folders_client_example_test.go @@ -0,0 +1,280 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package resourcemanager_test + +import ( + "context" + + resourcemanager "cloud.google.com/go/resourcemanager/apiv2" + "google.golang.org/api/iterator" + resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func ExampleNewFoldersClient() { + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleFoldersClient_ListFolders() { + // import resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &resourcemanagerpb.ListFoldersRequest{ + // TODO: Fill request struct fields. + } + it := c.ListFolders(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleFoldersClient_SearchFolders() { + // import resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &resourcemanagerpb.SearchFoldersRequest{ + // TODO: Fill request struct fields. + } + it := c.SearchFolders(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleFoldersClient_GetFolder() { + // import resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &resourcemanagerpb.GetFolderRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetFolder(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFoldersClient_CreateFolder() { + // import resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &resourcemanagerpb.CreateFolderRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateFolder(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFoldersClient_UpdateFolder() { + // import resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &resourcemanagerpb.UpdateFolderRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateFolder(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFoldersClient_MoveFolder() { + // import resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &resourcemanagerpb.MoveFolderRequest{ + // TODO: Fill request struct fields. + } + op, err := c.MoveFolder(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFoldersClient_DeleteFolder() { + // import resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &resourcemanagerpb.DeleteFolderRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteFolder(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFoldersClient_UndeleteFolder() { + // import resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &resourcemanagerpb.UndeleteFolderRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UndeleteFolder(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFoldersClient_GetIamPolicy() { + // import iampb "google.golang.org/genproto/googleapis/iam/v1" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFoldersClient_SetIamPolicy() { + // import iampb "google.golang.org/genproto/googleapis/iam/v1" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFoldersClient_TestIamPermissions() { + // import iampb "google.golang.org/genproto/googleapis/iam/v1" + + ctx := context.Background() + c, err := resourcemanager.NewFoldersClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/retail/apiv2/doc.go b/retail/apiv2/doc.go index 815078fe64f..0f49a460bd4 100644 --- a/retail/apiv2/doc.go +++ b/retail/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/scheduler/apiv1/doc.go b/scheduler/apiv1/doc.go index 5fbc3f4b725..b2deaee43ac 100644 --- a/scheduler/apiv1/doc.go +++ b/scheduler/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/scheduler/apiv1beta1/doc.go b/scheduler/apiv1beta1/doc.go index eb8fefe669a..a7dab32c623 100644 --- a/scheduler/apiv1beta1/doc.go +++ b/scheduler/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/secretmanager/apiv1/doc.go b/secretmanager/apiv1/doc.go index 0d96e3d52ea..41e9843ca5b 100644 --- a/secretmanager/apiv1/doc.go +++ b/secretmanager/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/secretmanager/apiv1beta1/doc.go b/secretmanager/apiv1beta1/doc.go index 91408b86e1f..d388d119833 100644 --- a/secretmanager/apiv1beta1/doc.go +++ b/secretmanager/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/security/privateca/apiv1beta1/doc.go b/security/privateca/apiv1beta1/doc.go index 2fd3b9b847f..5200d9ef5d7 100644 --- a/security/privateca/apiv1beta1/doc.go +++ b/security/privateca/apiv1beta1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1/doc.go b/securitycenter/apiv1/doc.go index 76c7dcc3dd1..3525f8f8ad5 100644 --- a/securitycenter/apiv1/doc.go +++ b/securitycenter/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1beta1/doc.go b/securitycenter/apiv1beta1/doc.go index 8974a8af5ef..cede7752573 100644 --- a/securitycenter/apiv1beta1/doc.go +++ b/securitycenter/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1p1beta1/doc.go b/securitycenter/apiv1p1beta1/doc.go index 82dc7dcdbbf..e70fc63b1fd 100644 --- a/securitycenter/apiv1p1beta1/doc.go +++ b/securitycenter/apiv1p1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/settings/apiv1beta1/doc.go b/securitycenter/settings/apiv1beta1/doc.go index 4d466ca8fbe..9411d0ac1c8 100644 --- a/securitycenter/settings/apiv1beta1/doc.go +++ b/securitycenter/settings/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicedirectory/apiv1/doc.go b/servicedirectory/apiv1/doc.go index 331ec5805af..7f5dfeb2c58 100644 --- a/servicedirectory/apiv1/doc.go +++ b/servicedirectory/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicedirectory/apiv1beta1/doc.go b/servicedirectory/apiv1beta1/doc.go index 42d9fb55814..e16dd613929 100644 --- a/servicedirectory/apiv1beta1/doc.go +++ b/servicedirectory/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/CHANGES.md b/spanner/CHANGES.md index 71f3c386580..b226c916150 100644 --- a/spanner/CHANGES.md +++ b/spanner/CHANGES.md @@ -1,5 +1,32 @@ # Changes +## [1.13.0](https://www.github.com/googleapis/google-cloud-go/compare/spanner/v1.12.0...v1.13.0) (2021-01-15) + + +### Features + +* **spanner/spannertest:** implement ANY_VALUE aggregation function ([#3428](https://www.github.com/googleapis/google-cloud-go/issues/3428)) ([e16c3e9](https://www.github.com/googleapis/google-cloud-go/commit/e16c3e9b412762b85483f3831ee586a5e6631313)) +* **spanner/spannertest:** implement FULL JOIN ([#3218](https://www.github.com/googleapis/google-cloud-go/issues/3218)) ([99f7212](https://www.github.com/googleapis/google-cloud-go/commit/99f7212bd70bb333c1aa1c7a57348b4dfd80d31b)) +* **spanner/spannertest:** implement SELECT ... FROM UNNEST(...) ([#3431](https://www.github.com/googleapis/google-cloud-go/issues/3431)) ([deb466f](https://www.github.com/googleapis/google-cloud-go/commit/deb466f497a1e6df78fcad57c3b90b1a4ccd93b4)) +* **spanner/spannertest:** support array literals ([#3438](https://www.github.com/googleapis/google-cloud-go/issues/3438)) ([69e0110](https://www.github.com/googleapis/google-cloud-go/commit/69e0110f4977035cd1a705c3034c3ba96cadf36f)) +* **spanner/spannertest:** support AVG aggregation function ([#3286](https://www.github.com/googleapis/google-cloud-go/issues/3286)) ([4788415](https://www.github.com/googleapis/google-cloud-go/commit/4788415c908f58c1cc08c951f1a7f17cdaf35aa2)) +* **spanner/spannertest:** support Not Null constraint ([#3491](https://www.github.com/googleapis/google-cloud-go/issues/3491)) ([c36aa07](https://www.github.com/googleapis/google-cloud-go/commit/c36aa0785e798b9339d540e691850ca3c474a288)) +* **spanner/spannertest:** support UPDATE DML ([#3201](https://www.github.com/googleapis/google-cloud-go/issues/3201)) ([1dec6f6](https://www.github.com/googleapis/google-cloud-go/commit/1dec6f6a31768a3f70bfec7274828301c22ea10b)) +* **spanner/spansql:** define structures and parse UPDATE DML statements ([#3192](https://www.github.com/googleapis/google-cloud-go/issues/3192)) ([23b6904](https://www.github.com/googleapis/google-cloud-go/commit/23b69042c58489df512703259f54d075ba0c0722)) +* **spanner/spansql:** support DATE and TIMESTAMP literals ([#3557](https://www.github.com/googleapis/google-cloud-go/issues/3557)) ([1961930](https://www.github.com/googleapis/google-cloud-go/commit/196193034a15f84dc3d3c27901990e8be77fca85)) +* **spanner/spansql:** support for parsing generated columns ([#3373](https://www.github.com/googleapis/google-cloud-go/issues/3373)) ([9b1d06f](https://www.github.com/googleapis/google-cloud-go/commit/9b1d06fc90a4c07899c641a893dba0b47a1cead9)) +* **spanner/spansql:** support NUMERIC data type ([#3411](https://www.github.com/googleapis/google-cloud-go/issues/3411)) ([1bc65d9](https://www.github.com/googleapis/google-cloud-go/commit/1bc65d9124ba22db5bec4c71b6378c27dfc04724)) +* **spanner:** Add a DirectPath fallback integration test ([#3487](https://www.github.com/googleapis/google-cloud-go/issues/3487)) ([de821c5](https://www.github.com/googleapis/google-cloud-go/commit/de821c59fb81e9946216d205162b59de8b5ce71c)) +* **spanner:** attempt DirectPath by default ([#3516](https://www.github.com/googleapis/google-cloud-go/issues/3516)) ([bbc61ed](https://www.github.com/googleapis/google-cloud-go/commit/bbc61ed368453b28aaf5bed627ca2499a3591f63)) +* **spanner:** include User agent ([#3465](https://www.github.com/googleapis/google-cloud-go/issues/3465)) ([4e1ef1b](https://www.github.com/googleapis/google-cloud-go/commit/4e1ef1b3fb536ef950249cdee02cc0b6c2b56e86)) +* **spanner:** run E2E test over DirectPath ([#3466](https://www.github.com/googleapis/google-cloud-go/issues/3466)) ([18e3a4f](https://www.github.com/googleapis/google-cloud-go/commit/18e3a4fe2a0c59c6295db2d85c7893ac51688083)) +* **spanner:** support NUMERIC in mutations ([#3328](https://www.github.com/googleapis/google-cloud-go/issues/3328)) ([fa90737](https://www.github.com/googleapis/google-cloud-go/commit/fa90737a2adbe0cefbaba4aa1046a6efbba2a0e9)) + + +### Bug Fixes + +* **spanner:** fix session leak ([#3461](https://www.github.com/googleapis/google-cloud-go/issues/3461)) ([11fb917](https://www.github.com/googleapis/google-cloud-go/commit/11fb91711db5b941995737980cef7b48b611fefd)), refs [#3460](https://www.github.com/googleapis/google-cloud-go/issues/3460) + ## [1.12.0](https://www.github.com/googleapis/google-cloud-go/compare/spanner/v1.11.0...v1.12.0) (2020-11-10) diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go index 2e0d77ad260..dcecaf91d2d 100644 --- a/spanner/admin/database/apiv1/doc.go +++ b/spanner/admin/database/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/admin/instance/apiv1/doc.go b/spanner/admin/instance/apiv1/doc.go index a2ae9fc9a59..5558bb498af 100644 --- a/spanner/admin/instance/apiv1/doc.go +++ b/spanner/admin/instance/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/apiv1/doc.go b/spanner/apiv1/doc.go index fd90ef4ddc6..9257dc482fb 100644 --- a/spanner/apiv1/doc.go +++ b/spanner/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/apiv1/spanner_client_options.go b/spanner/apiv1/spanner_client_options.go new file mode 100644 index 00000000000..639e890d4d8 --- /dev/null +++ b/spanner/apiv1/spanner_client_options.go @@ -0,0 +1,25 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spanner + +import "google.golang.org/api/option" + +// Returns the default client options used by the generated Spanner client. +// +// This function is only intended for use by the client library, and may be +// removed at any time without any warning. +func DefaultClientOptions() []option.ClientOption { + return defaultClientOptions() +} diff --git a/spanner/client.go b/spanner/client.go index 1a52fa5abfd..0e12690f74b 100644 --- a/spanner/client.go +++ b/spanner/client.go @@ -36,9 +36,6 @@ import ( ) const ( - endpoint = "spanner.googleapis.com:443" - mtlsEndpoint = "spanner.mtls.googleapis.com:443" - // resourcePrefixHeader is the name of the metadata header used to indicate // the resource being operated on. resourcePrefixHeader = "google-cloud-resource-prefix" @@ -47,14 +44,6 @@ const ( numChannels = 4 ) -const ( - // Scope is the scope for Cloud Spanner Data API. - Scope = "https://www.googleapis.com/auth/spanner.data" - - // AdminScope is the scope for Cloud Spanner Admin APIs. - AdminScope = "https://www.googleapis.com/auth/spanner.admin" -) - var ( validDBPattern = regexp.MustCompile("^projects/(?P[^/]+)/instances/(?P[^/]+)/databases/(?P[^/]+)$") ) @@ -116,13 +105,6 @@ type ClientConfig struct { logger *log.Logger } -// errDial returns error for dialing to Cloud Spanner. -func errDial(ci int, err error) error { - e := ToSpannerError(err).(*Error) - e.decorate(fmt.Sprintf("dialing fails for channel[%v]", ci)) - return e -} - func contextWithOutgoingMetadata(ctx context.Context, md metadata.MD) context.Context { existing, ok := metadata.FromOutgoingContext(ctx) if ok { @@ -166,22 +148,7 @@ func NewClientWithConfig(ctx context.Context, database string, config ClientConf config.NumChannels = numChannels } // gRPC options. - allOpts := []option.ClientOption{ - internaloption.WithDefaultEndpoint(endpoint), - internaloption.WithDefaultMTLSEndpoint(mtlsEndpoint), - option.WithScopes(Scope), - option.WithGRPCDialOption( - grpc.WithDefaultCallOptions( - grpc.MaxCallSendMsgSize(100<<20), - grpc.MaxCallRecvMsgSize(100<<20), - ), - ), - option.WithGRPCConnectionPool(config.NumChannels), - option.WithUserAgent(clientUserAgent), - } - // opts will take precedence above allOpts, as the values in opts will be - // applied after the values in allOpts. - allOpts = append(allOpts, opts...) + allOpts := allClientOpts(config.NumChannels, opts...) pool, err := gtransport.DialPool(ctx, allOpts...) if err != nil { return nil, err @@ -227,6 +194,20 @@ func NewClientWithConfig(ctx context.Context, database string, config ClientConf return c, nil } +// Combines the default options from the generated client, the default options +// of the hand-written client and the user options to one list of options. +// Precedence: userOpts > clientDefaultOpts > generatedDefaultOpts +func allClientOpts(numChannels int, userOpts ...option.ClientOption) []option.ClientOption { + generatedDefaultOpts := vkit.DefaultClientOptions() + clientDefaultOpts := []option.ClientOption{ + option.WithGRPCConnectionPool(numChannels), + option.WithUserAgent(clientUserAgent), + internaloption.EnableDirectPath(true), + } + allDefaultOpts := append(generatedDefaultOpts, clientDefaultOpts...) + return append(allDefaultOpts, userOpts...) +} + // getQueryOptions returns the query options overwritten by the environment // variables if exist. The input parameter is the query options set by users // via application-level configuration. If the environment variables are set, diff --git a/spanner/go.mod b/spanner/go.mod index cda14ed5db6..d409964f66e 100644 --- a/spanner/go.mod +++ b/spanner/go.mod @@ -10,10 +10,10 @@ require ( go.opencensus.io v0.22.5 golang.org/x/mod v0.4.1 // indirect golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 // indirect - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 google.golang.org/protobuf v1.25.0 ) diff --git a/spanner/go.sum b/spanner/go.sum index b3509a48a75..c1f3ae713c3 100644 --- a/spanner/go.sum +++ b/spanner/go.sum @@ -430,8 +430,8 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -499,8 +499,8 @@ google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/spanner/integration_test.go b/spanner/integration_test.go index 6c3a0738095..3f87716f47c 100644 --- a/spanner/integration_test.go +++ b/spanner/integration_test.go @@ -40,7 +40,6 @@ import ( instance "cloud.google.com/go/spanner/admin/instance/apiv1" "google.golang.org/api/iterator" "google.golang.org/api/option" - "google.golang.org/api/option/internaloption" adminpb "google.golang.org/genproto/googleapis/spanner/admin/database/v1" instancepb "google.golang.org/genproto/googleapis/spanner/admin/instance/v1" sppb "google.golang.org/genproto/googleapis/spanner/v1" @@ -239,8 +238,6 @@ func initIntegrationTests() (cleanup func()) { opts = append(opts, option.WithEndpoint(spannerHost)) } if dpConfig.attemptDirectPath { - // TODO(mohanli): Move EnableDirectPath internal option to client.go when DirectPath is ready for public beta. - opts = append(opts, internaloption.EnableDirectPath(true)) opts = append(opts, option.WithGRPCDialOption(grpc.WithDefaultCallOptions(grpc.Peer(peerInfo)))) } var err error @@ -3211,8 +3208,6 @@ func createClient(ctx context.Context, dbPath string, spc SessionPoolConfig) (cl opts = append(opts, option.WithEndpoint(spannerHost)) } if dpConfig.attemptDirectPath { - // TODO(mohanli): Move EnableDirectPath internal option to client.go when DirectPath is ready for public beta. - opts = append(opts, internaloption.EnableDirectPath(true)) opts = append(opts, option.WithGRPCDialOption(grpc.WithDefaultCallOptions(grpc.Peer(peerInfo)))) } client, err = NewClientWithConfig(ctx, dbPath, ClientConfig{SessionPoolConfig: spc}, opts...) diff --git a/spanner/spansql/sql.go b/spanner/spansql/sql.go index 99f7b7d1335..fee79916f50 100644 --- a/spanner/spansql/sql.go +++ b/spanner/spansql/sql.go @@ -331,7 +331,7 @@ func (sfj SelectFromJoin) SQL() string { // TODO: hints go here str += sfj.RHS.SQL() if sfj.On != nil { - str += " " + sfj.On.SQL() + str += " ON " + sfj.On.SQL() } else if len(sfj.Using) > 0 { str += " USING (" + idList(sfj.Using, ", ") + ")" } diff --git a/spanner/spansql/sql_test.go b/spanner/spansql/sql_test.go index 1f9db7db597..b4805489ed4 100644 --- a/spanner/spansql/sql_test.go +++ b/spanner/spansql/sql_test.go @@ -318,6 +318,29 @@ func TestSQL(t *testing.T) { `TIMESTAMP '2014-09-27 12:34:56.123456 -07:00'`, reparseExpr, }, + { + Query{ + Select: Select{ + List: []Expr{ + ID("A"), ID("B"), + }, + From: []SelectFrom{ + SelectFromJoin{ + Type: InnerJoin, + LHS: SelectFromTable{Table: "Table1"}, + RHS: SelectFromTable{Table: "Table2"}, + On: ComparisonOp{ + LHS: PathExp{"Table1", "A"}, + Op: Eq, + RHS: PathExp{"Table2", "A"}, + }, + }, + }, + }, + }, + "SELECT A, B FROM Table1 INNER JOIN Table2 ON Table1.A = Table2.A", + reparseQuery, + }, } for _, test := range tests { sql := test.data.SQL() diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go index 06b83ed3f1b..5e9cdaba444 100644 --- a/speech/apiv1/doc.go +++ b/speech/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/speech/apiv1p1beta1/doc.go b/speech/apiv1p1beta1/doc.go index 411596424c4..390c1bd76ac 100644 --- a/speech/apiv1p1beta1/doc.go +++ b/speech/apiv1p1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/storage/go.mod b/storage/go.mod index e06f1a0d71d..0e9a342fafe 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -9,8 +9,8 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/mod v0.4.1 // indirect golang.org/x/oauth2 v0.0.0-20210113160501-8b1d76fa0423 - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect google.golang.org/api v0.36.0 - google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 + google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f google.golang.org/grpc v1.34.1 ) diff --git a/storage/go.sum b/storage/go.sum index d62cdfca3cb..b92194d5a35 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -415,8 +415,8 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 h1:K+NlvTLy0oONtRtkl1jRD9xIhnItbG2PiE7YOdjPb+k= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -484,8 +484,8 @@ google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595 h1:x7nk+/4+SvuTDI4wnzQUlhvi+DTpyfncXBo3QWTFs7U= -google.golang.org/genproto v0.0.0-20210113195801-ae06605f4595/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= +google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/talent/apiv4/doc.go b/talent/apiv4/doc.go index 61f692c16b4..296bc5c3982 100644 --- a/talent/apiv4/doc.go +++ b/talent/apiv4/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/talent/apiv4beta1/doc.go b/talent/apiv4beta1/doc.go index 4d94d3ddca2..abfc17e51d8 100644 --- a/talent/apiv4beta1/doc.go +++ b/talent/apiv4beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/texttospeech/apiv1/doc.go b/texttospeech/apiv1/doc.go index cb4f81d1aad..ba4ef41fd01 100644 --- a/texttospeech/apiv1/doc.go +++ b/texttospeech/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/trace/apiv1/doc.go b/trace/apiv1/doc.go index edd37df1371..77511ec0e95 100644 --- a/trace/apiv1/doc.go +++ b/trace/apiv1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/trace/apiv2/doc.go b/trace/apiv2/doc.go index 7ab91817166..ba60cc61bf8 100644 --- a/trace/apiv2/doc.go +++ b/trace/apiv2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/translate/apiv3/doc.go b/translate/apiv3/doc.go index 4550e9add6f..f45abe3d7b8 100644 --- a/translate/apiv3/doc.go +++ b/translate/apiv3/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/video/transcoder/apiv1beta1/doc.go b/video/transcoder/apiv1beta1/doc.go index 5847e3d85f1..0c838c8b38c 100644 --- a/video/transcoder/apiv1beta1/doc.go +++ b/video/transcoder/apiv1beta1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/videointelligence/apiv1/doc.go b/videointelligence/apiv1/doc.go index 280fe16144c..2a17536657b 100644 --- a/videointelligence/apiv1/doc.go +++ b/videointelligence/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/videointelligence/apiv1beta2/doc.go b/videointelligence/apiv1beta2/doc.go index 23762cf83c8..4e8f4dbe5a6 100644 --- a/videointelligence/apiv1beta2/doc.go +++ b/videointelligence/apiv1beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vision/apiv1/doc.go b/vision/apiv1/doc.go index 223fa39df7d..4a52647125a 100644 --- a/vision/apiv1/doc.go +++ b/vision/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vision/apiv1p1beta1/doc.go b/vision/apiv1p1beta1/doc.go index d7fa203dc07..ea05ed9d0c0 100644 --- a/vision/apiv1p1beta1/doc.go +++ b/vision/apiv1p1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/webrisk/apiv1/doc.go b/webrisk/apiv1/doc.go index 986426e99ec..85e8b4f4b79 100644 --- a/webrisk/apiv1/doc.go +++ b/webrisk/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/webrisk/apiv1beta1/doc.go b/webrisk/apiv1beta1/doc.go index 772cf3fba77..63f7b22fd51 100644 --- a/webrisk/apiv1beta1/doc.go +++ b/webrisk/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/websecurityscanner/apiv1/doc.go b/websecurityscanner/apiv1/doc.go index 136456c816e..e39a8f53163 100644 --- a/websecurityscanner/apiv1/doc.go +++ b/websecurityscanner/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/workflows/apiv1beta/doc.go b/workflows/apiv1beta/doc.go index cc46c2f1224..9e977cf510f 100644 --- a/workflows/apiv1beta/doc.go +++ b/workflows/apiv1beta/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/workflows/executions/apiv1beta/doc.go b/workflows/executions/apiv1beta/doc.go index 3f2e1cec2d0..a468036e898 100644 --- a/workflows/executions/apiv1beta/doc.go +++ b/workflows/executions/apiv1beta/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210113" +const versionClient = "20210114" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx)