diff --git a/aiplatform/go.sum b/aiplatform/go.sum index 149f6944ef50..686b7968a0cc 100644 --- a/aiplatform/go.sum +++ b/aiplatform/go.sum @@ -530,7 +530,6 @@ google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8 h1:U9V52f6rAgINH7kT+musA1qF8kWyVOxzF8eYuOVuFwQ= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 h1:ErU+UA6wxadoU8nWrsy5MZUVBs75K17zUCsUCIfrXCE= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= diff --git a/go.mod b/go.mod index 61c8fe038c34..1fa50a84a373 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.73.0 - google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 + google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index e5ef8bebde2c..86679fbb03ed 100644 --- a/go.sum +++ b/go.sum @@ -550,8 +550,8 @@ google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 h1:ErU+UA6wxadoU8nWrsy5MZUVBs75K17zUCsUCIfrXCE= -google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e h1:fNKDNuUyC4WH+inqDMpfXDdfvwfYILbsX+oskGZ8hxg= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= 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/go.mod b/internal/generated/snippets/go.mod index c95afeee851d..97f0da18857b 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -112,7 +112,7 @@ require ( cloud.google.com/go/workflows v1.1.0 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect google.golang.org/api v0.73.0 - google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 + google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e ) replace cloud.google.com/go/storagetransfer => ../../../storagetransfer diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index af2f4f962fb4..6024d66684a3 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -172,8 +172,9 @@ google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220307174427-659dce7fcb03/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 h1:ErU+UA6wxadoU8nWrsy5MZUVBs75K17zUCsUCIfrXCE= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e h1:fNKDNuUyC4WH+inqDMpfXDdfvwfYILbsX+oskGZ8hxg= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= 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/generated/snippets/redis/apiv1/CloudRedisClient/GetInstanceAuthString/main.go b/internal/generated/snippets/redis/apiv1/CloudRedisClient/GetInstanceAuthString/main.go new file mode 100644 index 000000000000..ba7ba5a48431 --- /dev/null +++ b/internal/generated/snippets/redis/apiv1/CloudRedisClient/GetInstanceAuthString/main.go @@ -0,0 +1,48 @@ +// Copyright 2022 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START redis_v1_generated_CloudRedis_GetInstanceAuthString_sync] + +package main + +import ( + "context" + + redis "cloud.google.com/go/redis/apiv1" + redispb "google.golang.org/genproto/googleapis/cloud/redis/v1" +) + +func main() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &redispb.GetInstanceAuthStringRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/redis/v1#GetInstanceAuthStringRequest. + } + resp, err := c.GetInstanceAuthString(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END redis_v1_generated_CloudRedis_GetInstanceAuthString_sync] diff --git a/internal/generated/snippets/redis/apiv1/CloudRedisClient/RescheduleMaintenance/main.go b/internal/generated/snippets/redis/apiv1/CloudRedisClient/RescheduleMaintenance/main.go new file mode 100644 index 000000000000..c6dba4c3e228 --- /dev/null +++ b/internal/generated/snippets/redis/apiv1/CloudRedisClient/RescheduleMaintenance/main.go @@ -0,0 +1,53 @@ +// Copyright 2022 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START redis_v1_generated_CloudRedis_RescheduleMaintenance_sync] + +package main + +import ( + "context" + + redis "cloud.google.com/go/redis/apiv1" + redispb "google.golang.org/genproto/googleapis/cloud/redis/v1" +) + +func main() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &redispb.RescheduleMaintenanceRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/redis/v1#RescheduleMaintenanceRequest. + } + op, err := c.RescheduleMaintenance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END redis_v1_generated_CloudRedis_RescheduleMaintenance_sync] diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index 2736fa4d9b9d..859a7963f2dd 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -220,8 +220,8 @@ google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 h1:ErU+UA6wxadoU8nWrsy5MZUVBs75K17zUCsUCIfrXCE= -google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e h1:fNKDNuUyC4WH+inqDMpfXDdfvwfYILbsX+oskGZ8hxg= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= 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/redis/apiv1/cloud_redis_client.go b/redis/apiv1/cloud_redis_client.go index 144839268550..2bd2d3cab178 100644 --- a/redis/apiv1/cloud_redis_client.go +++ b/redis/apiv1/cloud_redis_client.go @@ -41,15 +41,17 @@ var newCloudRedisClientHook clientHook // CloudRedisCallOptions contains the retry settings for each method of CloudRedisClient. type CloudRedisCallOptions struct { - ListInstances []gax.CallOption - GetInstance []gax.CallOption - CreateInstance []gax.CallOption - UpdateInstance []gax.CallOption - UpgradeInstance []gax.CallOption - ImportInstance []gax.CallOption - ExportInstance []gax.CallOption - FailoverInstance []gax.CallOption - DeleteInstance []gax.CallOption + ListInstances []gax.CallOption + GetInstance []gax.CallOption + GetInstanceAuthString []gax.CallOption + CreateInstance []gax.CallOption + UpdateInstance []gax.CallOption + UpgradeInstance []gax.CallOption + ImportInstance []gax.CallOption + ExportInstance []gax.CallOption + FailoverInstance []gax.CallOption + DeleteInstance []gax.CallOption + RescheduleMaintenance []gax.CallOption } func defaultCloudRedisGRPCClientOptions() []option.ClientOption { @@ -66,15 +68,17 @@ func defaultCloudRedisGRPCClientOptions() []option.ClientOption { func defaultCloudRedisCallOptions() *CloudRedisCallOptions { return &CloudRedisCallOptions{ - ListInstances: []gax.CallOption{}, - GetInstance: []gax.CallOption{}, - CreateInstance: []gax.CallOption{}, - UpdateInstance: []gax.CallOption{}, - UpgradeInstance: []gax.CallOption{}, - ImportInstance: []gax.CallOption{}, - ExportInstance: []gax.CallOption{}, - FailoverInstance: []gax.CallOption{}, - DeleteInstance: []gax.CallOption{}, + ListInstances: []gax.CallOption{}, + GetInstance: []gax.CallOption{}, + GetInstanceAuthString: []gax.CallOption{}, + CreateInstance: []gax.CallOption{}, + UpdateInstance: []gax.CallOption{}, + UpgradeInstance: []gax.CallOption{}, + ImportInstance: []gax.CallOption{}, + ExportInstance: []gax.CallOption{}, + FailoverInstance: []gax.CallOption{}, + DeleteInstance: []gax.CallOption{}, + RescheduleMaintenance: []gax.CallOption{}, } } @@ -85,6 +89,7 @@ type internalCloudRedisClient interface { Connection() *grpc.ClientConn ListInstances(context.Context, *redispb.ListInstancesRequest, ...gax.CallOption) *InstanceIterator GetInstance(context.Context, *redispb.GetInstanceRequest, ...gax.CallOption) (*redispb.Instance, error) + GetInstanceAuthString(context.Context, *redispb.GetInstanceAuthStringRequest, ...gax.CallOption) (*redispb.InstanceAuthString, error) CreateInstance(context.Context, *redispb.CreateInstanceRequest, ...gax.CallOption) (*CreateInstanceOperation, error) CreateInstanceOperation(name string) *CreateInstanceOperation UpdateInstance(context.Context, *redispb.UpdateInstanceRequest, ...gax.CallOption) (*UpdateInstanceOperation, error) @@ -99,6 +104,8 @@ type internalCloudRedisClient interface { FailoverInstanceOperation(name string) *FailoverInstanceOperation DeleteInstance(context.Context, *redispb.DeleteInstanceRequest, ...gax.CallOption) (*DeleteInstanceOperation, error) DeleteInstanceOperation(name string) *DeleteInstanceOperation + RescheduleMaintenance(context.Context, *redispb.RescheduleMaintenanceRequest, ...gax.CallOption) (*RescheduleMaintenanceOperation, error) + RescheduleMaintenanceOperation(name string) *RescheduleMaintenanceOperation } // CloudRedisClient is a client for interacting with Google Cloud Memorystore for Redis API. @@ -177,6 +184,13 @@ func (c *CloudRedisClient) GetInstance(ctx context.Context, req *redispb.GetInst return c.internalClient.GetInstance(ctx, req, opts...) } +// GetInstanceAuthString gets the AUTH string for a Redis instance. If AUTH is not enabled for the +// instance the response will be empty. This information is not included in +// the details returned to GetInstance. +func (c *CloudRedisClient) GetInstanceAuthString(ctx context.Context, req *redispb.GetInstanceAuthStringRequest, opts ...gax.CallOption) (*redispb.InstanceAuthString, error) { + return c.internalClient.GetInstanceAuthString(ctx, req, opts...) +} + // CreateInstance creates a Redis instance based on the specified tier and memory size. // // By default, the instance is accessible from the project’s @@ -284,6 +298,18 @@ func (c *CloudRedisClient) DeleteInstanceOperation(name string) *DeleteInstanceO return c.internalClient.DeleteInstanceOperation(name) } +// RescheduleMaintenance reschedule maintenance for a given instance in a given project and +// location. +func (c *CloudRedisClient) RescheduleMaintenance(ctx context.Context, req *redispb.RescheduleMaintenanceRequest, opts ...gax.CallOption) (*RescheduleMaintenanceOperation, error) { + return c.internalClient.RescheduleMaintenance(ctx, req, opts...) +} + +// RescheduleMaintenanceOperation returns a new RescheduleMaintenanceOperation from a given name. +// The name must be that of a previously created RescheduleMaintenanceOperation, possibly from a different process. +func (c *CloudRedisClient) RescheduleMaintenanceOperation(name string) *RescheduleMaintenanceOperation { + return c.internalClient.RescheduleMaintenanceOperation(name) +} + // cloudRedisGRPCClient is a client for interacting with Google Cloud Memorystore for Redis API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -466,6 +492,28 @@ func (c *cloudRedisGRPCClient) GetInstance(ctx context.Context, req *redispb.Get return resp, nil } +func (c *cloudRedisGRPCClient) GetInstanceAuthString(ctx context.Context, req *redispb.GetInstanceAuthStringRequest, opts ...gax.CallOption) (*redispb.InstanceAuthString, 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).GetInstanceAuthString[0:len((*c.CallOptions).GetInstanceAuthString):len((*c.CallOptions).GetInstanceAuthString)], opts...) + var resp *redispb.InstanceAuthString + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.GetInstanceAuthString(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + func (c *cloudRedisGRPCClient) CreateInstance(ctx context.Context, req *redispb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 600000*time.Millisecond) @@ -634,6 +682,30 @@ func (c *cloudRedisGRPCClient) DeleteInstance(ctx context.Context, req *redispb. }, nil } +func (c *cloudRedisGRPCClient) RescheduleMaintenance(ctx context.Context, req *redispb.RescheduleMaintenanceRequest, opts ...gax.CallOption) (*RescheduleMaintenanceOperation, 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).RescheduleMaintenance[0:len((*c.CallOptions).RescheduleMaintenance):len((*c.CallOptions).RescheduleMaintenance)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.RescheduleMaintenance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &RescheduleMaintenanceOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + // CreateInstanceOperation manages a long-running operation from CreateInstance. type CreateInstanceOperation struct { lro *longrunning.Operation @@ -968,6 +1040,75 @@ func (op *ImportInstanceOperation) Name() string { return op.lro.Name() } +// RescheduleMaintenanceOperation manages a long-running operation from RescheduleMaintenance. +type RescheduleMaintenanceOperation struct { + lro *longrunning.Operation +} + +// RescheduleMaintenanceOperation returns a new RescheduleMaintenanceOperation from a given name. +// The name must be that of a previously created RescheduleMaintenanceOperation, possibly from a different process. +func (c *cloudRedisGRPCClient) RescheduleMaintenanceOperation(name string) *RescheduleMaintenanceOperation { + return &RescheduleMaintenanceOperation{ + 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 *RescheduleMaintenanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + 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 *RescheduleMaintenanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + 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 *RescheduleMaintenanceOperation) Metadata() (*redispb.OperationMetadata, error) { + var meta redispb.OperationMetadata + 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 *RescheduleMaintenanceOperation) 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 *RescheduleMaintenanceOperation) Name() string { + return op.lro.Name() +} + // UpdateInstanceOperation manages a long-running operation from UpdateInstance. type UpdateInstanceOperation struct { lro *longrunning.Operation diff --git a/redis/apiv1/cloud_redis_client_example_test.go b/redis/apiv1/cloud_redis_client_example_test.go index 40459e339f43..46072e878375 100644 --- a/redis/apiv1/cloud_redis_client_example_test.go +++ b/redis/apiv1/cloud_redis_client_example_test.go @@ -82,6 +82,26 @@ func ExampleCloudRedisClient_GetInstance() { _ = resp } +func ExampleCloudRedisClient_GetInstanceAuthString() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &redispb.GetInstanceAuthStringRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/redis/v1#GetInstanceAuthStringRequest. + } + resp, err := c.GetInstanceAuthString(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + func ExampleCloudRedisClient_CreateInstance() { ctx := context.Background() c, err := redis.NewCloudRedisClient(ctx) @@ -254,3 +274,28 @@ func ExampleCloudRedisClient_DeleteInstance() { // TODO: Handle error. } } + +func ExampleCloudRedisClient_RescheduleMaintenance() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &redispb.RescheduleMaintenanceRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/redis/v1#RescheduleMaintenanceRequest. + } + op, err := c.RescheduleMaintenance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/redis/apiv1/gapic_metadata.json b/redis/apiv1/gapic_metadata.json index 3898343a3c48..4e47c10042a7 100644 --- a/redis/apiv1/gapic_metadata.json +++ b/redis/apiv1/gapic_metadata.json @@ -35,6 +35,11 @@ "GetInstance" ] }, + "GetInstanceAuthString": { + "methods": [ + "GetInstanceAuthString" + ] + }, "ImportInstance": { "methods": [ "ImportInstance" @@ -45,6 +50,11 @@ "ListInstances" ] }, + "RescheduleMaintenance": { + "methods": [ + "RescheduleMaintenance" + ] + }, "UpdateInstance": { "methods": [ "UpdateInstance" diff --git a/redis/go.mod b/redis/go.mod index 545500590f65..326cb57228d0 100644 --- a/redis/go.mod +++ b/redis/go.mod @@ -6,8 +6,8 @@ require ( cloud.google.com/go v0.100.2 github.com/golang/protobuf v1.5.2 github.com/googleapis/gax-go/v2 v2.1.1 - google.golang.org/api v0.71.0 - google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8 + google.golang.org/api v0.73.0 + google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/redis/go.sum b/redis/go.sum index 9b6c83a4f6d4..ec74e684c357 100644 --- a/redis/go.sum +++ b/redis/go.sum @@ -286,8 +286,8 @@ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b h1:clP8eMhB30EHdc0bd2Twtq6kgU7yl5ub2cQLSdrv1Dg= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a h1:qfl7ob3DIEs3Ml9oLuPwY2N04gymzAW04WsUQHIClgM= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -350,8 +350,8 @@ golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -456,8 +456,8 @@ google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3h google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= -google.golang.org/api v0.71.0 h1:SgWof18M8V2NylsX7bL4fM28j+nFdRopHZbdipaaw20= -google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.73.0 h1:O9bThUh35K1rvUrQwTUQ1eqLC/IYyzUpWavYIO2EXvo= +google.golang.org/api v0.73.0/go.mod h1:lbd/q6BRFJbdpV6OUCXstVeiI5mL/d3/WifG7iNKnjI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -530,8 +530,9 @@ google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8 h1:U9V52f6rAgINH7kT+musA1qF8kWyVOxzF8eYuOVuFwQ= -google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e h1:fNKDNuUyC4WH+inqDMpfXDdfvwfYILbsX+oskGZ8hxg= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= 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=