all: regen gapics
Includes a genproto version bump after https://github.com/google/go-genproto/pull/157
Change-Id: I67a4c35d0c996a35f70ddd08f69b5bd681930c48
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/39731
Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
Reviewed-by: kokoro <noreply+kokoro@google.com>
diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go
index 780c20f..c6a4b8a 100644
--- a/cloudtasks/apiv2/doc.go
+++ b/cloudtasks/apiv2/doc.go
@@ -97,4 +97,4 @@
return "UNKNOWN"
}
-const versionClient = "20190404"
+const versionClient = "20190409"
diff --git a/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go
index 72f2963..6b0813a 100644
--- a/cloudtasks/apiv2beta2/doc.go
+++ b/cloudtasks/apiv2beta2/doc.go
@@ -97,4 +97,4 @@
return "UNKNOWN"
}
-const versionClient = "20190404"
+const versionClient = "20190409"
diff --git a/cloudtasks/apiv2beta3/cloud_tasks_client.go b/cloudtasks/apiv2beta3/cloud_tasks_client.go
index 1d6f45c..72d97b2 100644
--- a/cloudtasks/apiv2beta3/cloud_tasks_client.go
+++ b/cloudtasks/apiv2beta3/cloud_tasks_client.go
@@ -212,15 +212,14 @@
// CreateQueue creates a queue.
//
// Queues created with this method allow tasks to live for a maximum of 31
-// days. After a task is 31 days old, the task will be deleted regardless of
-// whether it was dispatched or not.
+// days. After a task is 31 days old, the task will be deleted regardless of whether
+// it was dispatched or not.
//
// WARNING: Using this method may have unintended side effects if you are
// using an App Engine queue.yaml or queue.xml file to manage your queues.
// Read
-// Overview of Queue Management and
-// queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml) before using
-// this method.
+// Overview of Queue Management and queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml)
+// before using this method.
func (c *Client) CreateQueue(ctx context.Context, req *taskspb.CreateQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -243,15 +242,14 @@
// the queue if it does exist.
//
// Queues created with this method allow tasks to live for a maximum of 31
-// days. After a task is 31 days old, the task will be deleted regardless of
-// whether it was dispatched or not.
+// days. After a task is 31 days old, the task will be deleted regardless of whether
+// it was dispatched or not.
//
// WARNING: Using this method may have unintended side effects if you are
// using an App Engine queue.yaml or queue.xml file to manage your queues.
// Read
-// Overview of Queue Management and
-// queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml) before using
-// this method.
+// Overview of Queue Management and queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml)
+// before using this method.
func (c *Client) UpdateQueue(ctx context.Context, req *taskspb.UpdateQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "queue.name", req.GetQueue().GetName()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -278,9 +276,8 @@
// WARNING: Using this method may have unintended side effects if you are
// using an App Engine queue.yaml or queue.xml file to manage your queues.
// Read
-// Overview of Queue Management and
-// queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml) before using
-// this method.
+// Overview of Queue Management and queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml)
+// before using this method.
func (c *Client) DeleteQueue(ctx context.Context, req *taskspb.DeleteQueueRequest, opts ...gax.CallOption) error {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -319,10 +316,9 @@
//
// If a queue is paused then the system will stop dispatching tasks
// until the queue is resumed via
-// [ResumeQueue][google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue]. Tasks can
-// still be added when the queue is paused. A queue is paused if its
-// [state][google.cloud.tasks.v2beta3.Queue.state] is
-// [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED].
+// [ResumeQueue][google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue]. Tasks can still be added
+// when the queue is paused. A queue is paused if its
+// [state][google.cloud.tasks.v2beta3.Queue.state] is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED].
func (c *Client) PauseQueue(ctx context.Context, req *taskspb.PauseQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -343,17 +339,14 @@
//
// This method resumes a queue after it has been
// [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED] or
-// [DISABLED][google.cloud.tasks.v2beta3.Queue.State.DISABLED]. The state of a
-// queue is stored in the queue's
-// [state][google.cloud.tasks.v2beta3.Queue.state]; after calling this method
-// it will be set to
-// [RUNNING][google.cloud.tasks.v2beta3.Queue.State.RUNNING].
+// [DISABLED][google.cloud.tasks.v2beta3.Queue.State.DISABLED]. The state of a queue is stored
+// in the queue's [state][google.cloud.tasks.v2beta3.Queue.state]; after calling this method it
+// will be set to [RUNNING][google.cloud.tasks.v2beta3.Queue.State.RUNNING].
//
// WARNING: Resuming many high-QPS queues at the same time can
// lead to target overloading. If you are resuming high-QPS
// queues, follow the 500/50/5 pattern described in
-// Managing Cloud Tasks Scaling
-// Risks (at https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
+// Managing Cloud Tasks Scaling Risks (at https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
func (c *Client) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -370,9 +363,9 @@
return resp, nil
}
-// GetIamPolicy gets the access control policy for a
-// [Queue][google.cloud.tasks.v2beta3.Queue]. Returns an empty policy if the
-// resource exists and does not have a policy set.
+// GetIamPolicy gets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue].
+// Returns an empty policy if the resource exists and does not have a policy
+// set.
//
// Authorization requires the following
// Google IAM (at https://cloud.google.com/iam) permission on the specified
@@ -395,8 +388,8 @@
return resp, nil
}
-// SetIamPolicy sets the access control policy for a
-// [Queue][google.cloud.tasks.v2beta3.Queue]. Replaces any existing policy.
+// SetIamPolicy sets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. Replaces any existing
+// policy.
//
// Note: The Cloud Console does not check queue-level IAM permissions yet.
// Project-level permissions are required to use the Cloud Console.
@@ -422,10 +415,9 @@
return resp, nil
}
-// TestIamPermissions returns permissions that a caller has on a
-// [Queue][google.cloud.tasks.v2beta3.Queue]. If the resource does not exist,
-// this will return an empty set of permissions, not a
-// [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
+// TestIamPermissions returns permissions that a caller has on a [Queue][google.cloud.tasks.v2beta3.Queue].
+// If the resource does not exist, this will return an empty set of
+// permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
//
// Note: This operation is designed to be used for building permission-aware
// UIs and command-line tools, not for authorization checking. This operation
@@ -448,10 +440,10 @@
// ListTasks lists the tasks in a queue.
//
-// By default, only the [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]
-// view is retrieved due to performance considerations;
-// [response_view][google.cloud.tasks.v2beta3.ListTasksRequest.response_view]
-// controls the subset of information which is returned.
+// By default, only the [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC] view is retrieved
+// due to performance considerations;
+// [response_view][google.cloud.tasks.v2beta3.ListTasksRequest.response_view] controls the
+// subset of information which is returned.
//
// The tasks may be returned in any order. The ordering may change at any
// time.
@@ -513,8 +505,7 @@
//
// Tasks cannot be updated after creation; there is no UpdateTask command.
//
-// For [App Engine queues][google.cloud.tasks.v2beta3.AppEngineHttpQueue],
-// the maximum task size is
+// For [App Engine queues][google.cloud.tasks.v2beta3.AppEngineHttpQueue], the maximum task size is
// 100KB.
func (c *Client) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent()))
@@ -552,14 +543,13 @@
// RunTask forces a task to run now.
//
// When this method is called, Cloud Tasks will dispatch the task, even if
-// the task is already running, the queue has reached its
-// [RateLimits][google.cloud.tasks.v2beta3.RateLimits] or is
-// [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED].
+// the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2beta3.RateLimits] or
+// is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED].
//
// This command is meant to be used for manual debugging. For
-// example, [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] can be
-// used to retry a failed task after a fix has been made or to manually force
-// a task to be dispatched now.
+// example, [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] can be used to retry a failed
+// task after a fix has been made or to manually force a task to be
+// dispatched now.
//
// The dispatched task is returned. That is, the task that is returned
// contains the [status][Task.status] after the task is dispatched but
@@ -567,11 +557,9 @@
//
// If Cloud Tasks receives a successful response from the task's
// target, then the task will be deleted; otherwise the task's
-// [schedule_time][google.cloud.tasks.v2beta3.Task.schedule_time] will be
-// reset to the time that
-// [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] was called plus
-// the retry delay specified in the queue's
-// [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig].
+// [schedule_time][google.cloud.tasks.v2beta3.Task.schedule_time] will be reset to the time that
+// [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] was called plus the retry delay specified
+// in the queue's [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig].
//
// [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] returns
// [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a
diff --git a/cloudtasks/apiv2beta3/doc.go b/cloudtasks/apiv2beta3/doc.go
index 5c93cf9..c91efc3 100644
--- a/cloudtasks/apiv2beta3/doc.go
+++ b/cloudtasks/apiv2beta3/doc.go
@@ -97,4 +97,4 @@
return "UNKNOWN"
}
-const versionClient = "20190404"
+const versionClient = "20190409"
diff --git a/cloudtasks/apiv2beta3/mock_test.go b/cloudtasks/apiv2beta3/mock_test.go
index ff90a14..164a5f0 100644
--- a/cloudtasks/apiv2beta3/mock_test.go
+++ b/cloudtasks/apiv2beta3/mock_test.go
@@ -357,8 +357,10 @@
}
func TestCloudTasksGetQueue(t *testing.T) {
var name2 string = "name2-1052831874"
+ var logSamplingRatio float64 = -1.25350193E8
var expectedResponse = &taskspb.Queue{
- Name: name2,
+ Name: name2,
+ LogSamplingRatio: logSamplingRatio,
}
mockCloudTasks.err = nil
@@ -416,8 +418,10 @@
}
func TestCloudTasksCreateQueue(t *testing.T) {
var name string = "name3373707"
+ var logSamplingRatio float64 = -1.25350193E8
var expectedResponse = &taskspb.Queue{
- Name: name,
+ Name: name,
+ LogSamplingRatio: logSamplingRatio,
}
mockCloudTasks.err = nil
@@ -479,8 +483,10 @@
}
func TestCloudTasksUpdateQueue(t *testing.T) {
var name string = "name3373707"
+ var logSamplingRatio float64 = -1.25350193E8
var expectedResponse = &taskspb.Queue{
- Name: name,
+ Name: name,
+ LogSamplingRatio: logSamplingRatio,
}
mockCloudTasks.err = nil
@@ -590,8 +596,10 @@
}
func TestCloudTasksPurgeQueue(t *testing.T) {
var name2 string = "name2-1052831874"
+ var logSamplingRatio float64 = -1.25350193E8
var expectedResponse = &taskspb.Queue{
- Name: name2,
+ Name: name2,
+ LogSamplingRatio: logSamplingRatio,
}
mockCloudTasks.err = nil
@@ -649,8 +657,10 @@
}
func TestCloudTasksPauseQueue(t *testing.T) {
var name2 string = "name2-1052831874"
+ var logSamplingRatio float64 = -1.25350193E8
var expectedResponse = &taskspb.Queue{
- Name: name2,
+ Name: name2,
+ LogSamplingRatio: logSamplingRatio,
}
mockCloudTasks.err = nil
@@ -708,8 +718,10 @@
}
func TestCloudTasksResumeQueue(t *testing.T) {
var name2 string = "name2-1052831874"
+ var logSamplingRatio float64 = -1.25350193E8
var expectedResponse = &taskspb.Queue{
- Name: name2,
+ Name: name2,
+ LogSamplingRatio: logSamplingRatio,
}
mockCloudTasks.err = nil
diff --git a/go.mod b/go.mod
index bcc2fcd..ae0de4a 100644
--- a/go.mod
+++ b/go.mod
@@ -18,7 +18,7 @@
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138
google.golang.org/api v0.3.1
- google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107
+ google.golang.org/genproto v0.0.0-20190415143225-d1146b9035b9
google.golang.org/grpc v1.19.0
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a
)
diff --git a/go.sum b/go.sum
index 6705ef8..a84d4ed 100644
--- a/go.sum
+++ b/go.sum
@@ -128,8 +128,8 @@
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 h1:Lj2SnHtxkRGJDqnGaSjo+CCdIieEnwVazbOXILwQemk=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
-google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107 h1:xtNn7qFlagY2mQNFHMSRPjT2RkOV4OXM7P5TVy9xATo=
-google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190415143225-d1146b9035b9 h1:SymueV2ZwWqdojv3IQn27haYaNer4MttGly0aZCMpoc=
+google.golang.org/genproto v0.0.0-20190415143225-d1146b9035b9/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=
diff --git a/redis/apiv1/doc.go b/redis/apiv1/doc.go
index af854d2..13a4be6 100644
--- a/redis/apiv1/doc.go
+++ b/redis/apiv1/doc.go
@@ -97,4 +97,4 @@
return "UNKNOWN"
}
-const versionClient = "20190404"
+const versionClient = "20190409"
diff --git a/redis/apiv1beta1/cloud_redis_client.go b/redis/apiv1beta1/cloud_redis_client.go
index 8d4cf56..461dd5c 100644
--- a/redis/apiv1beta1/cloud_redis_client.go
+++ b/redis/apiv1beta1/cloud_redis_client.go
@@ -38,11 +38,12 @@
// 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
- DeleteInstance []gax.CallOption
+ ListInstances []gax.CallOption
+ GetInstance []gax.CallOption
+ CreateInstance []gax.CallOption
+ UpdateInstance []gax.CallOption
+ DeleteInstance []gax.CallOption
+ FailoverInstance []gax.CallOption
}
func defaultCloudRedisClientOptions() []option.ClientOption {
@@ -55,11 +56,12 @@
func defaultCloudRedisCallOptions() *CloudRedisCallOptions {
retry := map[[2]string][]gax.CallOption{}
return &CloudRedisCallOptions{
- ListInstances: retry[[2]string{"default", "non_idempotent"}],
- GetInstance: retry[[2]string{"default", "non_idempotent"}],
- CreateInstance: retry[[2]string{"default", "non_idempotent"}],
- UpdateInstance: retry[[2]string{"default", "non_idempotent"}],
- DeleteInstance: retry[[2]string{"default", "non_idempotent"}],
+ ListInstances: retry[[2]string{"default", "non_idempotent"}],
+ GetInstance: retry[[2]string{"default", "non_idempotent"}],
+ CreateInstance: retry[[2]string{"default", "non_idempotent"}],
+ UpdateInstance: retry[[2]string{"default", "non_idempotent"}],
+ DeleteInstance: retry[[2]string{"default", "non_idempotent"}],
+ FailoverInstance: retry[[2]string{"default", "non_idempotent"}],
}
}
@@ -218,7 +220,7 @@
// CreateInstance creates a Redis instance based on the specified tier and memory size.
//
-// By default, the instance is peered to the project's
+// By default, the instance is accessible from the project's
// default network (at /compute/docs/networks-and-firewalls#networks).
//
// The creation is executed asynchronously and callers may check the returned
@@ -289,6 +291,26 @@
}, nil
}
+// FailoverInstance failover the master role to current replica node against a specific
+// STANDARD tier redis instance.
+func (c *CloudRedisClient) FailoverInstance(ctx context.Context, req *redispb.FailoverInstanceRequest, opts ...gax.CallOption) (*FailoverInstanceOperation, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName()))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.FailoverInstance[0:len(c.CallOptions.FailoverInstance):len(c.CallOptions.FailoverInstance)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.cloudRedisClient.FailoverInstance(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &FailoverInstanceOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
// InstanceIterator manages a stream of *redispb.Instance.
type InstanceIterator struct {
items []*redispb.Instance
@@ -456,6 +478,75 @@
return op.lro.Name()
}
+// FailoverInstanceOperation manages a long-running operation from FailoverInstance.
+type FailoverInstanceOperation struct {
+ lro *longrunning.Operation
+}
+
+// FailoverInstanceOperation returns a new FailoverInstanceOperation from a given name.
+// The name must be that of a previously created FailoverInstanceOperation, possibly from a different process.
+func (c *CloudRedisClient) FailoverInstanceOperation(name string) *FailoverInstanceOperation {
+ return &FailoverInstanceOperation{
+ 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 *FailoverInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) {
+ var resp redispb.Instance
+ if err := op.lro.WaitWithInterval(ctx, &resp, 360000*time.Millisecond, 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 *FailoverInstanceOperation) 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 *FailoverInstanceOperation) Metadata() (*anypb.Any, error) {
+ var meta anypb.Any
+ 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 *FailoverInstanceOperation) 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 *FailoverInstanceOperation) Name() string {
+ return op.lro.Name()
+}
+
// UpdateInstanceOperation manages a long-running operation from UpdateInstance.
type UpdateInstanceOperation struct {
lro *longrunning.Operation
diff --git a/redis/apiv1beta1/cloud_redis_client_example_test.go b/redis/apiv1beta1/cloud_redis_client_example_test.go
index e932f8a..688a9b5 100644
--- a/redis/apiv1beta1/cloud_redis_client_example_test.go
+++ b/redis/apiv1beta1/cloud_redis_client_example_test.go
@@ -140,3 +140,26 @@
err = op.Wait(ctx)
// TODO: Handle error.
}
+
+func ExampleCloudRedisClient_FailoverInstance() {
+ ctx := context.Background()
+ c, err := redis.NewCloudRedisClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &redispb.FailoverInstanceRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.FailoverInstance(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/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go
index e892d72..c6948f6 100644
--- a/redis/apiv1beta1/doc.go
+++ b/redis/apiv1beta1/doc.go
@@ -19,9 +19,7 @@
//
// NOTE: This package is in beta. It is not stable, and may be subject to changes.
//
-// The Google Cloud Memorystore for Redis API is used for creating and
-// managing
-// Redis instances on the Google Cloud Platform.
+// Creates and manages Redis instances on the Google Cloud Platform.
//
// Use of Context
//
@@ -99,4 +97,4 @@
return "UNKNOWN"
}
-const versionClient = "20190404"
+const versionClient = "20190409"
diff --git a/redis/apiv1beta1/mock_test.go b/redis/apiv1beta1/mock_test.go
index 09b59b3..09fdcc7 100644
--- a/redis/apiv1beta1/mock_test.go
+++ b/redis/apiv1beta1/mock_test.go
@@ -111,6 +111,18 @@
return s.resps[0].(*longrunningpb.Operation), nil
}
+func (s *mockCloudRedisServer) FailoverInstance(ctx context.Context, req *redispb.FailoverInstanceRequest) (*longrunningpb.Operation, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*longrunningpb.Operation), nil
+}
+
func (s *mockCloudRedisServer) DeleteInstance(ctx context.Context, req *redispb.DeleteInstanceRequest) (*longrunningpb.Operation, error) {
md, _ := metadata.FromIncomingContext(ctx)
if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
@@ -639,3 +651,114 @@
t.Errorf("got error code %q, want %q", c, errCode)
}
}
+func TestCloudRedisFailoverInstance(t *testing.T) {
+ var name2 string = "name2-1052831874"
+ var displayName string = "displayName1615086568"
+ var locationId string = "locationId552319461"
+ var alternativeLocationId string = "alternativeLocationId-718920621"
+ var redisVersion string = "redisVersion-685310444"
+ var reservedIpRange string = "reservedIpRange-1082940580"
+ var host string = "host3208616"
+ var port int32 = 3446913
+ var currentLocationId string = "currentLocationId1312712735"
+ var statusMessage string = "statusMessage-239442758"
+ var memorySizeGb int32 = 34199707
+ var authorizedNetwork string = "authorizedNetwork-1733809270"
+ var expectedResponse = &redispb.Instance{
+ Name: name2,
+ DisplayName: displayName,
+ LocationId: locationId,
+ AlternativeLocationId: alternativeLocationId,
+ RedisVersion: redisVersion,
+ ReservedIpRange: reservedIpRange,
+ Host: host,
+ Port: port,
+ CurrentLocationId: currentLocationId,
+ StatusMessage: statusMessage,
+ MemorySizeGb: memorySizeGb,
+ AuthorizedNetwork: authorizedNetwork,
+ }
+
+ mockCloudRedis.err = nil
+ mockCloudRedis.reqs = nil
+
+ any, err := ptypes.MarshalAny(expectedResponse)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Response{Response: any},
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]")
+ var dataProtectionMode redispb.FailoverInstanceRequest_DataProtectionMode = redispb.FailoverInstanceRequest_DATA_PROTECTION_MODE_UNSPECIFIED
+ var request = &redispb.FailoverInstanceRequest{
+ Name: formattedName,
+ DataProtectionMode: dataProtectionMode,
+ }
+
+ c, err := NewCloudRedisClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.FailoverInstance(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestCloudRedisFailoverInstanceError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockCloudRedis.err = nil
+ mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Error{
+ Error: &status.Status{
+ Code: int32(errCode),
+ Message: "test error",
+ },
+ },
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]")
+ var dataProtectionMode redispb.FailoverInstanceRequest_DataProtectionMode = redispb.FailoverInstanceRequest_DATA_PROTECTION_MODE_UNSPECIFIED
+ var request = &redispb.FailoverInstanceRequest{
+ Name: formattedName,
+ DataProtectionMode: dataProtectionMode,
+ }
+
+ c, err := NewCloudRedisClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.FailoverInstance(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
diff --git a/scheduler/apiv1/doc.go b/scheduler/apiv1/doc.go
index c1b23e1..2639144 100644
--- a/scheduler/apiv1/doc.go
+++ b/scheduler/apiv1/doc.go
@@ -97,4 +97,4 @@
return "UNKNOWN"
}
-const versionClient = "20190404"
+const versionClient = "20190409"
diff --git a/scheduler/apiv1beta1/cloud_scheduler_client.go b/scheduler/apiv1beta1/cloud_scheduler_client.go
index 4e8c773..d579d8c 100644
--- a/scheduler/apiv1beta1/cloud_scheduler_client.go
+++ b/scheduler/apiv1beta1/cloud_scheduler_client.go
@@ -209,14 +209,13 @@
// UpdateJob updates a job.
//
-// If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is
-// returned. If the job does not exist, NOT_FOUND is returned.
+// If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is returned. If the job does
+// not exist, NOT_FOUND is returned.
//
// If UpdateJob does not successfully return, it is possible for the
-// job to be in an
-// [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED]
-// state. A job in this state may not be executed. If this happens, retry the
-// UpdateJob request until a successful response is received.
+// job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED] state. A job in this state may
+// not be executed. If this happens, retry the UpdateJob request
+// until a successful response is received.
func (c *CloudSchedulerClient) UpdateJob(ctx context.Context, req *schedulerpb.UpdateJobRequest, opts ...gax.CallOption) (*schedulerpb.Job, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "job.name", req.GetJob().GetName()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -249,14 +248,10 @@
// PauseJob pauses a job.
//
// If a job is paused then the system will stop executing the job
-// until it is re-enabled via
-// [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. The
-// state of the job is stored in
-// [state][google.cloud.scheduler.v1beta1.Job.state]; if paused it will be set
-// to [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. A
-// job must be in
-// [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED] to be
-// paused.
+// until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. The
+// state of the job is stored in [state][google.cloud.scheduler.v1beta1.Job.state]; if paused it
+// will be set to [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED]
+// to be paused.
func (c *CloudSchedulerClient) PauseJob(ctx context.Context, req *schedulerpb.PauseJobRequest, opts ...gax.CallOption) (*schedulerpb.Job, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -275,15 +270,10 @@
// ResumeJob resume a job.
//
-// This method reenables a job after it has been
-// [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. The
-// state of a job is stored in
-// [Job.state][google.cloud.scheduler.v1beta1.Job.state]; after calling this
-// method it will be set to
-// [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED]. A
-// job must be in
-// [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED] to be
-// resumed.
+// This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. The
+// state of a job is stored in [Job.state][google.cloud.scheduler.v1beta1.Job.state]; after calling this method it
+// will be set to [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED]. A job must be in
+// [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED] to be resumed.
func (c *CloudSchedulerClient) ResumeJob(ctx context.Context, req *schedulerpb.ResumeJobRequest, opts ...gax.CallOption) (*schedulerpb.Job, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
diff --git a/scheduler/apiv1beta1/doc.go b/scheduler/apiv1beta1/doc.go
index 59f438d..ea18322 100644
--- a/scheduler/apiv1beta1/doc.go
+++ b/scheduler/apiv1beta1/doc.go
@@ -97,4 +97,4 @@
return "UNKNOWN"
}
-const versionClient = "20190404"
+const versionClient = "20190409"
diff --git a/talent/apiv4beta1/doc.go b/talent/apiv4beta1/doc.go
index a2d504a..75aa79b 100644
--- a/talent/apiv4beta1/doc.go
+++ b/talent/apiv4beta1/doc.go
@@ -99,4 +99,4 @@
return "UNKNOWN"
}
-const versionClient = "20190404"
+const versionClient = "20190409"
diff --git a/talent/apiv4beta1/job_client.go b/talent/apiv4beta1/job_client.go
index c8b1dc9..8c00434 100644
--- a/talent/apiv4beta1/job_client.go
+++ b/talent/apiv4beta1/job_client.go
@@ -259,13 +259,11 @@
return err
}
-// SearchJobs searches for jobs using the provided
-// [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
+// SearchJobs searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
//
-// This call constrains the
-// [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs present in
-// the database, and only returns jobs that the caller has permission to
-// search against.
+// This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs
+// present in the database, and only returns jobs that the caller has
+// permission to search against.
func (c *JobClient) SearchJobs(ctx context.Context, req *talentpb.SearchJobsRequest, opts ...gax.CallOption) *SearchJobsResponse_MatchingJobIterator {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -303,18 +301,16 @@
return it
}
-// SearchJobsForAlert searches for jobs using the provided
-// [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
+// SearchJobsForAlert searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
//
// This API call is intended for the use case of targeting passive job
// seekers (for example, job seekers who have signed up to receive email
// alerts about potential job opportunities), and has different algorithmic
// adjustments that are targeted to passive job seekers.
//
-// This call constrains the
-// [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs present in
-// the database, and only returns jobs the caller has permission to search
-// against.
+// This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs
+// present in the database, and only returns jobs the caller has
+// permission to search against.
func (c *JobClient) SearchJobsForAlert(ctx context.Context, req *talentpb.SearchJobsRequest, opts ...gax.CallOption) *SearchJobsResponse_MatchingJobIterator {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
diff --git a/talent/apiv4beta1/profile_client.go b/talent/apiv4beta1/profile_client.go
index 9255b50..681dd92 100644
--- a/talent/apiv4beta1/profile_client.go
+++ b/talent/apiv4beta1/profile_client.go
@@ -240,9 +240,7 @@
// For example, search by raw queries "software engineer in Mountain View" or
// search by structured filters (location filter, education filter, etc.).
//
-// See
-// [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]
-// for more information.
+// See [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] for more information.
func (c *ProfileClient) SearchProfiles(ctx context.Context, req *talentpb.SearchProfilesRequest, opts ...gax.CallOption) *HistogramQueryResultIterator {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent()))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)