diff --git a/channel/apiv1/cloud_channel_client.go b/channel/apiv1/cloud_channel_client.go index 6efbce98d5f..61de846bc2d 100644 --- a/channel/apiv1/cloud_channel_client.go +++ b/channel/apiv1/cloud_channel_client.go @@ -67,6 +67,7 @@ type CloudChannelCallOptions struct { GetChannelPartnerLink []gax.CallOption CreateChannelPartnerLink []gax.CallOption UpdateChannelPartnerLink []gax.CallOption + LookupOffer []gax.CallOption ListProducts []gax.CallOption ListSkus []gax.CallOption ListOffers []gax.CallOption @@ -256,6 +257,17 @@ func defaultCloudChannelCallOptions() *CloudChannelCallOptions { }) }), }, + LookupOffer: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, ListProducts: []gax.CallOption{ gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ @@ -388,6 +400,7 @@ type internalCloudChannelClient interface { GetChannelPartnerLink(context.Context, *channelpb.GetChannelPartnerLinkRequest, ...gax.CallOption) (*channelpb.ChannelPartnerLink, error) CreateChannelPartnerLink(context.Context, *channelpb.CreateChannelPartnerLinkRequest, ...gax.CallOption) (*channelpb.ChannelPartnerLink, error) UpdateChannelPartnerLink(context.Context, *channelpb.UpdateChannelPartnerLinkRequest, ...gax.CallOption) (*channelpb.ChannelPartnerLink, error) + LookupOffer(context.Context, *channelpb.LookupOfferRequest, ...gax.CallOption) (*channelpb.Offer, error) ListProducts(context.Context, *channelpb.ListProductsRequest, ...gax.CallOption) *ProductIterator ListSkus(context.Context, *channelpb.ListSkusRequest, ...gax.CallOption) *SkuIterator ListOffers(context.Context, *channelpb.ListOffersRequest, ...gax.CallOption) *OfferIterator @@ -474,7 +487,7 @@ func (c *CloudChannelClient) ListCustomers(ctx context.Context, req *channelpb.L return c.internalClient.ListCustomers(ctx, req, opts...) } -// GetCustomer returns a requested Customer resource. +// GetCustomer returns the requested Customer resource. // // Possible error codes: // @@ -552,7 +565,7 @@ func (c *CloudChannelClient) UpdateCustomer(ctx context.Context, req *channelpb. return c.internalClient.UpdateCustomer(ctx, req, opts...) } -// DeleteCustomer deletes the given Customer permanently and irreversibly. +// DeleteCustomer deletes the given Customer permanently. // // Possible error codes: // @@ -670,7 +683,7 @@ func (c *CloudChannelClient) ListTransferableOffers(ctx context.Context, req *ch return c.internalClient.ListTransferableOffers(ctx, req, opts...) } -// GetEntitlement returns a requested Entitlement resource. +// GetEntitlement returns the requested Entitlement resource. // // Possible error codes: // @@ -1135,7 +1148,7 @@ func (c *CloudChannelClient) ListChannelPartnerLinks(ctx context.Context, req *c return c.internalClient.ListChannelPartnerLinks(ctx, req, opts...) } -// GetChannelPartnerLink returns a requested ChannelPartnerLink resource. +// GetChannelPartnerLink returns the requested ChannelPartnerLink resource. // You must be a distributor to call this method. // // Possible error codes: @@ -1217,6 +1230,22 @@ func (c *CloudChannelClient) UpdateChannelPartnerLink(ctx context.Context, req * return c.internalClient.UpdateChannelPartnerLink(ctx, req, opts...) } +// LookupOffer returns the requested Offer resource. +// +// Possible error codes: +// +// PERMISSION_DENIED: The entitlement doesn’t belong to the reseller. +// +// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// +// NOT_FOUND: Entitlement or offer was not found. +// +// Return value: +// The Offer resource. +func (c *CloudChannelClient) LookupOffer(ctx context.Context, req *channelpb.LookupOfferRequest, opts ...gax.CallOption) (*channelpb.Offer, error) { + return c.internalClient.LookupOffer(ctx, req, opts...) +} + // ListProducts lists the Products the reseller is authorized to sell. // // Possible error codes: @@ -2108,6 +2137,27 @@ func (c *cloudChannelGRPCClient) UpdateChannelPartnerLink(ctx context.Context, r return resp, nil } +func (c *cloudChannelGRPCClient) LookupOffer(ctx context.Context, req *channelpb.LookupOfferRequest, opts ...gax.CallOption) (*channelpb.Offer, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "entitlement", url.QueryEscape(req.GetEntitlement()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).LookupOffer[0:len((*c.CallOptions).LookupOffer):len((*c.CallOptions).LookupOffer)], opts...) + var resp *channelpb.Offer + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudChannelClient.LookupOffer(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + func (c *cloudChannelGRPCClient) ListProducts(ctx context.Context, req *channelpb.ListProductsRequest, opts ...gax.CallOption) *ProductIterator { ctx = insertMetadata(ctx, c.xGoogMetadata) opts = append((*c.CallOptions).ListProducts[0:len((*c.CallOptions).ListProducts):len((*c.CallOptions).ListProducts)], opts...) diff --git a/channel/apiv1/cloud_channel_client_example_test.go b/channel/apiv1/cloud_channel_client_example_test.go index e7d11b60c9f..5191937e53b 100644 --- a/channel/apiv1/cloud_channel_client_example_test.go +++ b/channel/apiv1/cloud_channel_client_example_test.go @@ -590,6 +590,25 @@ func ExampleCloudChannelClient_UpdateChannelPartnerLink() { _ = resp } +func ExampleCloudChannelClient_LookupOffer() { + ctx := context.Background() + c, err := channel.NewCloudChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &channelpb.LookupOfferRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.LookupOffer(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + func ExampleCloudChannelClient_ListProducts() { ctx := context.Background() c, err := channel.NewCloudChannelClient(ctx) diff --git a/channel/apiv1/doc.go b/channel/apiv1/doc.go index 6fca36d9078..87f7042763a 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 = "20210607" +const versionClient = "20210608" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/channel/apiv1/gapic_metadata.json b/channel/apiv1/gapic_metadata.json index dd962451109..70fd450e2eb 100644 --- a/channel/apiv1/gapic_metadata.json +++ b/channel/apiv1/gapic_metadata.json @@ -130,6 +130,11 @@ "ListTransferableSkus" ] }, + "LookupOffer": { + "methods": [ + "LookupOffer" + ] + }, "ProvisionCloudIdentity": { "methods": [ "ProvisionCloudIdentity" diff --git a/container/apiv1/doc.go b/container/apiv1/doc.go index 6fe56a140b5..531eb3fe1e2 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 = "20210607" +const versionClient = "20210608" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go index 90b3abbafd5..b7d07f4c2b7 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 = "20210607" +const versionClient = "20210608" 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 7daa4264150..7b8610494f6 100644 --- a/dialogflow/cx/apiv3beta1/doc.go +++ b/dialogflow/cx/apiv3beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210607" +const versionClient = "20210608" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/go.mod b/go.mod index 14fb1e76c03..bf2994b167a 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( golang.org/x/text v0.3.6 golang.org/x/tools v0.1.2 google.golang.org/api v0.48.0 - google.golang.org/genproto v0.0.0-20210608175058-d8f7434f6428 + google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index 9af2daf1109..24521f6270b 100644 --- a/go.sum +++ b/go.sum @@ -448,8 +448,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608175058-d8f7434f6428 h1:ITsjBuiO/w/WrKEnQQNVf771ttSDxvlH3cfVloxqKXA= -google.golang.org/genproto v0.0.0-20210608175058-d8f7434f6428/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d h1:KzwjikDymrEmYYbdyfievTwjEeGlu+OM6oiKBkF3Jfg= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= 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/generated/snippets/channel/apiv1/CloudChannelClient/LookupOffer/main.go b/internal/generated/snippets/channel/apiv1/CloudChannelClient/LookupOffer/main.go new file mode 100644 index 00000000000..ac2559e8d86 --- /dev/null +++ b/internal/generated/snippets/channel/apiv1/CloudChannelClient/LookupOffer/main.go @@ -0,0 +1,45 @@ +// 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 +// +// http://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. + +// [START cloudchannel_v1_generated_CloudChannelService_LookupOffer_sync] + +package main + +import ( + "context" + + channel "cloud.google.com/go/channel/apiv1" + channelpb "google.golang.org/genproto/googleapis/cloud/channel/v1" +) + +func main() { + ctx := context.Background() + c, err := channel.NewCloudChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &channelpb.LookupOfferRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.LookupOffer(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudchannel_v1_generated_CloudChannelService_LookupOffer_sync] diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index 23b8905a5e0..8704b2ae832 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -31,6 +31,6 @@ require ( cloud.google.com/go/pubsub v1.9.1 cloud.google.com/go/pubsublite v0.83.0 cloud.google.com/go/spanner v0.83.0 - google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08 + google.golang.org/api v0.48.0 + google.golang.org/genproto v0.0.0-20210608175058-d8f7434f6428 ) diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index bed49bb8700..e316ed11f6a 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -107,8 +107,9 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644 h1:CA1DEQ4NdKphKeL70tvsWNdT5oFh1lOjihRcEDROi0I= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -132,8 +133,9 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.47.0 h1:sQLWZQvP6jPGIP4JGPkJu4zHswrv81iobiyszr3b/0I= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= +google.golang.org/api v0.48.0 h1:RDAPWfNFY06dffEXfn7hZF5Fr1ZbnChzfQZAPyBd1+I= +google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= @@ -144,8 +146,10 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08 h1:pc16UedxnxXXtGxHCSUhafAoVHQZ0yXl8ZelMH4EETc= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210607140030-00d4fb20b1ae/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608175058-d8f7434f6428 h1:ITsjBuiO/w/WrKEnQQNVf771ttSDxvlH3cfVloxqKXA= +google.golang.org/genproto v0.0.0-20210608175058-d8f7434f6428/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= 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/lifesciences/apiv2beta/doc.go b/lifesciences/apiv2beta/doc.go index 007f24a19c3..bc2d240618a 100644 --- a/lifesciences/apiv2beta/doc.go +++ b/lifesciences/apiv2beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210607" +const versionClient = "20210608" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/resourcesettings/apiv1/doc.go b/resourcesettings/apiv1/doc.go index 752a84b7968..129aa027d16 100644 --- a/resourcesettings/apiv1/doc.go +++ b/resourcesettings/apiv1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210607" +const versionClient = "20210608" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx)