Skip to content

Commit

Permalink
feat: upgradeInstance added in v1beta1; pass x-goog-request-params he…
Browse files Browse the repository at this point in the history
…ader for streaming calls
  • Loading branch information
yoshi-automation authored Feb 7, 2020
1 parent a299f8c commit 229022a
Show file tree
Hide file tree
Showing 12 changed files with 982 additions and 421 deletions.
3 changes: 1 addition & 2 deletions packages/google-cloud-redis/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/*.log
**/node_modules
.coverage
coverage
.nyc_output
docs/
out/
Expand All @@ -9,7 +10,5 @@ system-test/secrets.js
system-test/*key.json
*.lock
.DS_Store
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
package-lock.json
__pycache__
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ service CloudRedis {
// location (region) or all locations.
//
// The location should have the following format:
//
// * `projects/{project_id}/locations/{location_id}`
//
// If `location_id` is specified as `-` (wildcard), then all regions
Expand Down Expand Up @@ -230,15 +231,28 @@ message Instance {
STANDARD_HA = 3;
}

// Available connection modes.
enum ConnectMode {
// Not set.
CONNECT_MODE_UNSPECIFIED = 0;

// Connect via directly peering with memorystore redis hosted service.
DIRECT_PEERING = 1;

// Connect with google via private service access and share connection
// across google managed services.
PRIVATE_SERVICE_ACCESS = 2;
}

// Required. Unique name of the resource in this scope including project and
// location using the form:
// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
//
// Note: Redis instances are managed and addressed at regional level so
// location_id here refers to a GCP region; however, users may choose which
// specific zone (or collection of zones for cross-zone instances) an instance
// should be provisioned in. Refer to [location_id] and
// [alternative_location_id] fields for more details.
// should be provisioned in. Refer to [location_id][google.cloud.redis.v1.Instance.location_id] and
// [alternative_location_id][google.cloud.redis.v1.Instance.alternative_location_id] fields for more details.
string name = 1 [(google.api.field_behavior) = REQUIRED];

// An arbitrary and optional user-provided name for the instance.
Expand All @@ -250,19 +264,18 @@ message Instance {
// Optional. The zone where the instance will be provisioned. If not provided,
// the service will choose a zone for the instance. For STANDARD_HA tier,
// instances will be created across two zones for protection against zonal
// failures. If [alternative_location_id] is also provided, it must be
// different from [location_id].
// failures. If [alternative_location_id][google.cloud.redis.v1.Instance.alternative_location_id] is also provided, it must be
// different from [location_id][google.cloud.redis.v1.Instance.location_id].
string location_id = 4 [(google.api.field_behavior) = OPTIONAL];

// Optional. Only applicable to STANDARD_HA tier which protects the instance
// against zonal failures by provisioning it across two zones. If provided, it
// must be a different zone from the one provided in [location_id].
// must be a different zone from the one provided in [location_id][google.cloud.redis.v1.Instance.location_id].
string alternative_location_id = 5 [(google.api.field_behavior) = OPTIONAL];

// Optional. The version of Redis software.
// If not provided, latest supported version will be used. Updating the
// version will perform an upgrade/downgrade to the new version. Currently,
// the supported values are:
// If not provided, latest supported version will be used. Currently, the
// supported values are:
//
// * `REDIS_4_0` for Redis 4.0 compatibility (default)
// * `REDIS_3_2` for Redis 3.2 compatibility
Expand All @@ -282,9 +295,9 @@ message Instance {
int32 port = 11 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The current zone where the Redis endpoint is placed. For Basic
// Tier instances, this will always be the same as the [location_id]
// Tier instances, this will always be the same as the [location_id][google.cloud.redis.v1.Instance.location_id]
// provided by the user at creation time. For Standard Tier instances,
// this can be either [location_id] or [alternative_location_id] and can
// this can be either [location_id][google.cloud.redis.v1.Instance.location_id] or [alternative_location_id][google.cloud.redis.v1.Instance.alternative_location_id] and can
// change after a failover event.
string current_location_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY];

Expand Down Expand Up @@ -332,6 +345,11 @@ message Instance {
// for a given instance so should be checked before each import/export
// operation.
string persistence_iam_identity = 21 [(google.api.field_behavior) = OUTPUT_ONLY];

// Optional. The connect mode of Redis instance.
// If not provided, default one will be used.
// Current default: DIRECT_PEERING.
ConnectMode connect_mode = 22 [(google.api.field_behavior) = OPTIONAL];
}

// Request for [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances].
Expand All @@ -351,12 +369,12 @@ message ListInstancesRequest {
// If not specified, a default value of 1000 will be used by the service.
// Regardless of the page_size value, the response may include a partial list
// and a caller should only rely on response's
// [next_page_token][CloudRedis.ListInstancesResponse.next_page_token]
// [`next_page_token`][google.cloud.redis.v1.ListInstancesResponse.next_page_token]
// to determine if there are more instances left to be queried.
int32 page_size = 2;

// The next_page_token value returned from a previous List request,
// if any.
// The `next_page_token` value returned from a previous
// [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances] request, if any.
string page_token = 3;
}

Expand All @@ -368,10 +386,10 @@ message ListInstancesResponse {
// If the `location_id` in the parent field of the request is "-", all regions
// available to the project are queried, and the results aggregated.
// If in such an aggregated query a location is unavailable, a dummy Redis
// entry is included in the response with the "name" field set to a value of
// the form projects/{project_id}/locations/{location_id}/instances/- and the
// "status" field set to ERROR and "status_message" field set to "location not
// available for ListInstances".
// entry is included in the response with the `name` field set to a value of
// the form `projects/{project_id}/locations/{location_id}/instances/`- and
// the `status` field set to ERROR and `status_message` field set to "location
// not available for ListInstances".
repeated Instance instances = 1;

// Token to retrieve the next page of results, or empty if there are no more
Expand Down Expand Up @@ -425,7 +443,7 @@ message CreateInstanceRequest {
message UpdateInstanceRequest {
// Required. Mask of fields to update. At least one path must be supplied in
// this field. The elements of the repeated paths field may only include these
// fields from [Instance][CloudRedis.Instance]:
// fields from [Instance][google.cloud.redis.v1.Instance]:
//
// * `displayName`
// * `labels`
Expand Down Expand Up @@ -506,6 +524,7 @@ message ExportInstanceRequest {

// Request for [Failover][google.cloud.redis.v1.CloudRedis.FailoverInstance].
message FailoverInstanceRequest {
// Specifies different modes of operation in relation to the data retention.
enum DataProtectionMode {
// Defaults to LIMITED_DATA_LOSS if a data protection mode is not
// specified.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ service CloudRedis {
// location (region) or all locations.
//
// The location should have the following format:
//
// * `projects/{project_id}/locations/{location_id}`
//
// If `location_id` is specified as `-` (wildcard), then all regions
Expand Down Expand Up @@ -113,6 +114,20 @@ service CloudRedis {
};
}

// Upgrades Redis instance to the newer Redis version specified in the
// request.
rpc UpgradeInstance(UpgradeInstanceRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{name=projects/*/locations/*/instances/*}:upgrade"
body: "*"
};
option (google.api.method_signature) = "name,redis_version";
option (google.longrunning.operation_info) = {
response_type: "google.cloud.redis.v1beta1.Instance"
metadata_type: "google.protobuf.Any"
};
}

// Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
//
// Redis may stop serving during this operation. Instance state will be
Expand Down Expand Up @@ -230,15 +245,28 @@ message Instance {
STANDARD_HA = 3;
}

// Available connection modes.
enum ConnectMode {
// Not set.
CONNECT_MODE_UNSPECIFIED = 0;

// Connect via directly peering with memorystore redis hosted service.
DIRECT_PEERING = 1;

// Connect with google via private service access and share connection
// across google managed services.
PRIVATE_SERVICE_ACCESS = 2;
}

// Required. Unique name of the resource in this scope including project and
// location using the form:
// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
//
// Note: Redis instances are managed and addressed at regional level so
// location_id here refers to a GCP region; however, users may choose which
// specific zone (or collection of zones for cross-zone instances) an instance
// should be provisioned in. Refer to [location_id] and
// [alternative_location_id] fields for more details.
// should be provisioned in. Refer to [location_id][google.cloud.redis.v1beta1.Instance.location_id] and
// [alternative_location_id][google.cloud.redis.v1beta1.Instance.alternative_location_id] fields for more details.
string name = 1 [(google.api.field_behavior) = REQUIRED];

// An arbitrary and optional user-provided name for the instance.
Expand All @@ -250,19 +278,18 @@ message Instance {
// Optional. The zone where the instance will be provisioned. If not provided,
// the service will choose a zone for the instance. For STANDARD_HA tier,
// instances will be created across two zones for protection against zonal
// failures. If [alternative_location_id] is also provided, it must be
// different from [location_id].
// failures. If [alternative_location_id][google.cloud.redis.v1beta1.Instance.alternative_location_id] is also provided, it must be
// different from [location_id][google.cloud.redis.v1beta1.Instance.location_id].
string location_id = 4 [(google.api.field_behavior) = OPTIONAL];

// Optional. Only applicable to STANDARD_HA tier which protects the instance
// against zonal failures by provisioning it across two zones. If provided, it
// must be a different zone from the one provided in [location_id].
// must be a different zone from the one provided in [location_id][google.cloud.redis.v1beta1.Instance.location_id].
string alternative_location_id = 5 [(google.api.field_behavior) = OPTIONAL];

// Optional. The version of Redis software.
// If not provided, latest supported version will be used. Updating the
// version will perform an upgrade/downgrade to the new version. Currently,
// the supported values are:
// If not provided, latest supported version will be used. Currently, the
// supported values are:
//
// * `REDIS_4_0` for Redis 4.0 compatibility (default)
// * `REDIS_3_2` for Redis 3.2 compatibility
Expand All @@ -282,9 +309,9 @@ message Instance {
int32 port = 11 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The current zone where the Redis endpoint is placed. For Basic
// Tier instances, this will always be the same as the [location_id]
// Tier instances, this will always be the same as the [location_id][google.cloud.redis.v1beta1.Instance.location_id]
// provided by the user at creation time. For Standard Tier instances,
// this can be either [location_id] or [alternative_location_id] and can
// this can be either [location_id][google.cloud.redis.v1beta1.Instance.location_id] or [alternative_location_id][google.cloud.redis.v1beta1.Instance.alternative_location_id] and can
// change after a failover event.
string current_location_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY];

Expand Down Expand Up @@ -332,6 +359,11 @@ message Instance {
// for a given instance so should be checked before each import/export
// operation.
string persistence_iam_identity = 21 [(google.api.field_behavior) = OUTPUT_ONLY];

// Optional. The connect mode of Redis instance.
// If not provided, default one will be used.
// Current default: DIRECT_PEERING.
ConnectMode connect_mode = 22 [(google.api.field_behavior) = OPTIONAL];
}

// Request for [ListInstances][google.cloud.redis.v1beta1.CloudRedis.ListInstances].
Expand All @@ -351,12 +383,12 @@ message ListInstancesRequest {
// If not specified, a default value of 1000 will be used by the service.
// Regardless of the page_size value, the response may include a partial list
// and a caller should only rely on response's
// [next_page_token][CloudRedis.ListInstancesResponse.next_page_token]
// [`next_page_token`][google.cloud.redis.v1beta1.ListInstancesResponse.next_page_token]
// to determine if there are more instances left to be queried.
int32 page_size = 2;

// The next_page_token value returned from a previous List request,
// if any.
// The `next_page_token` value returned from a previous
// [ListInstances][google.cloud.redis.v1beta1.CloudRedis.ListInstances] request, if any.
string page_token = 3;
}

Expand All @@ -368,10 +400,10 @@ message ListInstancesResponse {
// If the `location_id` in the parent field of the request is "-", all regions
// available to the project are queried, and the results aggregated.
// If in such an aggregated query a location is unavailable, a dummy Redis
// entry is included in the response with the "name" field set to a value of
// the form projects/{project_id}/locations/{location_id}/instances/- and the
// "status" field set to ERROR and "status_message" field set to "location not
// available for ListInstances".
// entry is included in the response with the `name` field set to a value of
// the form `projects/{project_id}/locations/{location_id}/instances/`- and
// the `status` field set to ERROR and `status_message` field set to "location
// not available for ListInstances".
repeated Instance instances = 1;

// Token to retrieve the next page of results, or empty if there are no more
Expand Down Expand Up @@ -438,6 +470,22 @@ message UpdateInstanceRequest {
Instance instance = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request for [UpgradeInstance][google.cloud.redis.v1beta1.CloudRedis.UpgradeInstance].
message UpgradeInstanceRequest {
// Required. Redis instance resource name using the form:
// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
// where `location_id` refers to a GCP region.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "redis.googleapis.com/Instance"
}
];

// Required. Specifies the target version of Redis software to upgrade to.
string redis_version = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request for [DeleteInstance][google.cloud.redis.v1beta1.CloudRedis.DeleteInstance].
message DeleteInstanceRequest {
// Required. Redis instance resource name using the form:
Expand Down Expand Up @@ -506,6 +554,7 @@ message ExportInstanceRequest {

// Request for [Failover][google.cloud.redis.v1beta1.CloudRedis.FailoverInstance].
message FailoverInstanceRequest {
// Specifies different modes of operation in relation to the data retention.
enum DataProtectionMode {
// Defaults to LIMITED_DATA_LOSS if a data protection mode is not
// specified.
Expand Down
Loading

0 comments on commit 229022a

Please sign in to comment.