From 229022acac72a41eaaa1a1b6413c338a3f932fc3 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 7 Feb 2020 10:30:26 -0800 Subject: [PATCH] feat: upgradeInstance added in v1beta1; pass x-goog-request-params header for streaming calls --- packages/google-cloud-redis/.gitignore | 3 +- .../google/cloud/redis/v1/cloud_redis.proto | 55 ++- .../cloud/redis/v1beta1/cloud_redis.proto | 83 +++- .../google-cloud-redis/protos/protos.d.ts | 143 +++++++ packages/google-cloud-redis/protos/protos.js | 355 ++++++++++++++++++ .../google-cloud-redis/protos/protos.json | 58 +++ .../src/v1/cloud_redis_client.ts | 107 +++--- .../src/v1beta1/cloud_redis_client.ts | 208 +++++++--- .../v1beta1/cloud_redis_client_config.json | 4 + packages/google-cloud-redis/synth.metadata | 288 +------------- .../test/gapic-cloud_redis-v1.ts | 18 +- .../test/gapic-cloud_redis-v1beta1.ts | 81 +++- 12 files changed, 982 insertions(+), 421 deletions(-) diff --git a/packages/google-cloud-redis/.gitignore b/packages/google-cloud-redis/.gitignore index a4b7d6a3c59..5d32b23782f 100644 --- a/packages/google-cloud-redis/.gitignore +++ b/packages/google-cloud-redis/.gitignore @@ -1,6 +1,7 @@ **/*.log **/node_modules .coverage +coverage .nyc_output docs/ out/ @@ -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__ diff --git a/packages/google-cloud-redis/protos/google/cloud/redis/v1/cloud_redis.proto b/packages/google-cloud-redis/protos/google/cloud/redis/v1/cloud_redis.proto index 1c9cd495da6..c16ceb60494 100644 --- a/packages/google-cloud-redis/protos/google/cloud/redis/v1/cloud_redis.proto +++ b/packages/google-cloud-redis/protos/google/cloud/redis/v1/cloud_redis.proto @@ -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 @@ -230,6 +231,19 @@ 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}` @@ -237,8 +251,8 @@ message Instance { // 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. @@ -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 @@ -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]; @@ -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]. @@ -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; } @@ -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 @@ -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` @@ -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. diff --git a/packages/google-cloud-redis/protos/google/cloud/redis/v1beta1/cloud_redis.proto b/packages/google-cloud-redis/protos/google/cloud/redis/v1beta1/cloud_redis.proto index eafd8eb4ea8..968523fe5b7 100644 --- a/packages/google-cloud-redis/protos/google/cloud/redis/v1beta1/cloud_redis.proto +++ b/packages/google-cloud-redis/protos/google/cloud/redis/v1beta1/cloud_redis.proto @@ -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 @@ -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 @@ -230,6 +245,19 @@ 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}` @@ -237,8 +265,8 @@ message Instance { // 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. @@ -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 @@ -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]; @@ -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]. @@ -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; } @@ -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 @@ -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: @@ -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. diff --git a/packages/google-cloud-redis/protos/protos.d.ts b/packages/google-cloud-redis/protos/protos.d.ts index 16eb6639c41..e1ea4c9bade 100644 --- a/packages/google-cloud-redis/protos/protos.d.ts +++ b/packages/google-cloud-redis/protos/protos.d.ts @@ -274,6 +274,9 @@ export namespace google { /** Instance persistenceIamIdentity */ persistenceIamIdentity?: (string|null); + + /** Instance connectMode */ + connectMode?: (google.cloud.redis.v1.Instance.ConnectMode|keyof typeof google.cloud.redis.v1.Instance.ConnectMode|null); } /** Represents an Instance. */ @@ -339,6 +342,9 @@ export namespace google { /** Instance persistenceIamIdentity. */ public persistenceIamIdentity: string; + /** Instance connectMode. */ + public connectMode: (google.cloud.redis.v1.Instance.ConnectMode|keyof typeof google.cloud.redis.v1.Instance.ConnectMode); + /** * Creates a new Instance instance using the specified properties. * @param [properties] Properties to set @@ -431,6 +437,13 @@ export namespace google { BASIC = 1, STANDARD_HA = 3 } + + /** ConnectMode enum. */ + enum ConnectMode { + CONNECT_MODE_UNSPECIFIED = 0, + DIRECT_PEERING = 1, + PRIVATE_SERVICE_ACCESS = 2 + } } /** Properties of a ListInstancesRequest. */ @@ -2059,6 +2072,20 @@ export namespace google { */ public updateInstance(request: google.cloud.redis.v1beta1.IUpdateInstanceRequest): Promise; + /** + * Calls UpgradeInstance. + * @param request UpgradeInstanceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public upgradeInstance(request: google.cloud.redis.v1beta1.IUpgradeInstanceRequest, callback: google.cloud.redis.v1beta1.CloudRedis.UpgradeInstanceCallback): void; + + /** + * Calls UpgradeInstance. + * @param request UpgradeInstanceRequest message or plain object + * @returns Promise + */ + public upgradeInstance(request: google.cloud.redis.v1beta1.IUpgradeInstanceRequest): Promise; + /** * Calls ImportInstance. * @param request ImportInstanceRequest message or plain object @@ -2146,6 +2173,13 @@ export namespace google { */ type UpdateInstanceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.redis.v1beta1.CloudRedis#upgradeInstance}. + * @param error Error, if any + * @param [response] Operation + */ + type UpgradeInstanceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.redis.v1beta1.CloudRedis#importInstance}. * @param error Error, if any @@ -2231,6 +2265,9 @@ export namespace google { /** Instance persistenceIamIdentity */ persistenceIamIdentity?: (string|null); + + /** Instance connectMode */ + connectMode?: (google.cloud.redis.v1beta1.Instance.ConnectMode|keyof typeof google.cloud.redis.v1beta1.Instance.ConnectMode|null); } /** Represents an Instance. */ @@ -2296,6 +2333,9 @@ export namespace google { /** Instance persistenceIamIdentity. */ public persistenceIamIdentity: string; + /** Instance connectMode. */ + public connectMode: (google.cloud.redis.v1beta1.Instance.ConnectMode|keyof typeof google.cloud.redis.v1beta1.Instance.ConnectMode); + /** * Creates a new Instance instance using the specified properties. * @param [properties] Properties to set @@ -2388,6 +2428,13 @@ export namespace google { BASIC = 1, STANDARD_HA = 3 } + + /** ConnectMode enum. */ + enum ConnectMode { + CONNECT_MODE_UNSPECIFIED = 0, + DIRECT_PEERING = 1, + PRIVATE_SERVICE_ACCESS = 2 + } } /** Properties of a ListInstancesRequest. */ @@ -2882,6 +2929,102 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an UpgradeInstanceRequest. */ + interface IUpgradeInstanceRequest { + + /** UpgradeInstanceRequest name */ + name?: (string|null); + + /** UpgradeInstanceRequest redisVersion */ + redisVersion?: (string|null); + } + + /** Represents an UpgradeInstanceRequest. */ + class UpgradeInstanceRequest implements IUpgradeInstanceRequest { + + /** + * Constructs a new UpgradeInstanceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.redis.v1beta1.IUpgradeInstanceRequest); + + /** UpgradeInstanceRequest name. */ + public name: string; + + /** UpgradeInstanceRequest redisVersion. */ + public redisVersion: string; + + /** + * Creates a new UpgradeInstanceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpgradeInstanceRequest instance + */ + public static create(properties?: google.cloud.redis.v1beta1.IUpgradeInstanceRequest): google.cloud.redis.v1beta1.UpgradeInstanceRequest; + + /** + * Encodes the specified UpgradeInstanceRequest message. Does not implicitly {@link google.cloud.redis.v1beta1.UpgradeInstanceRequest.verify|verify} messages. + * @param message UpgradeInstanceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.redis.v1beta1.IUpgradeInstanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpgradeInstanceRequest message, length delimited. Does not implicitly {@link google.cloud.redis.v1beta1.UpgradeInstanceRequest.verify|verify} messages. + * @param message UpgradeInstanceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.redis.v1beta1.IUpgradeInstanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpgradeInstanceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpgradeInstanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.redis.v1beta1.UpgradeInstanceRequest; + + /** + * Decodes an UpgradeInstanceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpgradeInstanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.redis.v1beta1.UpgradeInstanceRequest; + + /** + * Verifies an UpgradeInstanceRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpgradeInstanceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpgradeInstanceRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.redis.v1beta1.UpgradeInstanceRequest; + + /** + * Creates a plain object from an UpgradeInstanceRequest message. Also converts values to other types if specified. + * @param message UpgradeInstanceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.redis.v1beta1.UpgradeInstanceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpgradeInstanceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a DeleteInstanceRequest. */ interface IDeleteInstanceRequest { diff --git a/packages/google-cloud-redis/protos/protos.js b/packages/google-cloud-redis/protos/protos.js index 76bfa99f753..40faf5b2f4d 100644 --- a/packages/google-cloud-redis/protos/protos.js +++ b/packages/google-cloud-redis/protos/protos.js @@ -389,6 +389,7 @@ * @property {number|null} [memorySizeGb] Instance memorySizeGb * @property {string|null} [authorizedNetwork] Instance authorizedNetwork * @property {string|null} [persistenceIamIdentity] Instance persistenceIamIdentity + * @property {google.cloud.redis.v1.Instance.ConnectMode|null} [connectMode] Instance connectMode */ /** @@ -552,6 +553,14 @@ */ Instance.prototype.persistenceIamIdentity = ""; + /** + * Instance connectMode. + * @member {google.cloud.redis.v1.Instance.ConnectMode} connectMode + * @memberof google.cloud.redis.v1.Instance + * @instance + */ + Instance.prototype.connectMode = 0; + /** * Creates a new Instance instance using the specified properties. * @function create @@ -614,6 +623,8 @@ writer.uint32(/* id 20, wireType 2 =*/162).string(message.authorizedNetwork); if (message.persistenceIamIdentity != null && message.hasOwnProperty("persistenceIamIdentity")) writer.uint32(/* id 21, wireType 2 =*/170).string(message.persistenceIamIdentity); + if (message.connectMode != null && message.hasOwnProperty("connectMode")) + writer.uint32(/* id 22, wireType 0 =*/176).int32(message.connectMode); return writer; }; @@ -712,6 +723,9 @@ case 21: message.persistenceIamIdentity = reader.string(); break; + case 22: + message.connectMode = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -831,6 +845,15 @@ if (message.persistenceIamIdentity != null && message.hasOwnProperty("persistenceIamIdentity")) if (!$util.isString(message.persistenceIamIdentity)) return "persistenceIamIdentity: string expected"; + if (message.connectMode != null && message.hasOwnProperty("connectMode")) + switch (message.connectMode) { + default: + return "connectMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -943,6 +966,20 @@ message.authorizedNetwork = String(object.authorizedNetwork); if (object.persistenceIamIdentity != null) message.persistenceIamIdentity = String(object.persistenceIamIdentity); + switch (object.connectMode) { + case "CONNECT_MODE_UNSPECIFIED": + case 0: + message.connectMode = 0; + break; + case "DIRECT_PEERING": + case 1: + message.connectMode = 1; + break; + case "PRIVATE_SERVICE_ACCESS": + case 2: + message.connectMode = 2; + break; + } return message; }; @@ -980,6 +1017,7 @@ object.memorySizeGb = 0; object.authorizedNetwork = ""; object.persistenceIamIdentity = ""; + object.connectMode = options.enums === String ? "CONNECT_MODE_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -1024,6 +1062,8 @@ object.authorizedNetwork = message.authorizedNetwork; if (message.persistenceIamIdentity != null && message.hasOwnProperty("persistenceIamIdentity")) object.persistenceIamIdentity = message.persistenceIamIdentity; + if (message.connectMode != null && message.hasOwnProperty("connectMode")) + object.connectMode = options.enums === String ? $root.google.cloud.redis.v1.Instance.ConnectMode[message.connectMode] : message.connectMode; return object; }; @@ -1082,6 +1122,22 @@ return values; })(); + /** + * ConnectMode enum. + * @name google.cloud.redis.v1.Instance.ConnectMode + * @enum {string} + * @property {number} CONNECT_MODE_UNSPECIFIED=0 CONNECT_MODE_UNSPECIFIED value + * @property {number} DIRECT_PEERING=1 DIRECT_PEERING value + * @property {number} PRIVATE_SERVICE_ACCESS=2 PRIVATE_SERVICE_ACCESS value + */ + Instance.ConnectMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONNECT_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DIRECT_PEERING"] = 1; + values[valuesById[2] = "PRIVATE_SERVICE_ACCESS"] = 2; + return values; + })(); + return Instance; })(); @@ -4769,6 +4825,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.redis.v1beta1.CloudRedis#upgradeInstance}. + * @memberof google.cloud.redis.v1beta1.CloudRedis + * @typedef UpgradeInstanceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpgradeInstance. + * @function upgradeInstance + * @memberof google.cloud.redis.v1beta1.CloudRedis + * @instance + * @param {google.cloud.redis.v1beta1.IUpgradeInstanceRequest} request UpgradeInstanceRequest message or plain object + * @param {google.cloud.redis.v1beta1.CloudRedis.UpgradeInstanceCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudRedis.prototype.upgradeInstance = function upgradeInstance(request, callback) { + return this.rpcCall(upgradeInstance, $root.google.cloud.redis.v1beta1.UpgradeInstanceRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpgradeInstance" }); + + /** + * Calls UpgradeInstance. + * @function upgradeInstance + * @memberof google.cloud.redis.v1beta1.CloudRedis + * @instance + * @param {google.cloud.redis.v1beta1.IUpgradeInstanceRequest} request UpgradeInstanceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.redis.v1beta1.CloudRedis#importInstance}. * @memberof google.cloud.redis.v1beta1.CloudRedis @@ -4928,6 +5017,7 @@ * @property {number|null} [memorySizeGb] Instance memorySizeGb * @property {string|null} [authorizedNetwork] Instance authorizedNetwork * @property {string|null} [persistenceIamIdentity] Instance persistenceIamIdentity + * @property {google.cloud.redis.v1beta1.Instance.ConnectMode|null} [connectMode] Instance connectMode */ /** @@ -5091,6 +5181,14 @@ */ Instance.prototype.persistenceIamIdentity = ""; + /** + * Instance connectMode. + * @member {google.cloud.redis.v1beta1.Instance.ConnectMode} connectMode + * @memberof google.cloud.redis.v1beta1.Instance + * @instance + */ + Instance.prototype.connectMode = 0; + /** * Creates a new Instance instance using the specified properties. * @function create @@ -5153,6 +5251,8 @@ writer.uint32(/* id 20, wireType 2 =*/162).string(message.authorizedNetwork); if (message.persistenceIamIdentity != null && message.hasOwnProperty("persistenceIamIdentity")) writer.uint32(/* id 21, wireType 2 =*/170).string(message.persistenceIamIdentity); + if (message.connectMode != null && message.hasOwnProperty("connectMode")) + writer.uint32(/* id 22, wireType 0 =*/176).int32(message.connectMode); return writer; }; @@ -5251,6 +5351,9 @@ case 21: message.persistenceIamIdentity = reader.string(); break; + case 22: + message.connectMode = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -5370,6 +5473,15 @@ if (message.persistenceIamIdentity != null && message.hasOwnProperty("persistenceIamIdentity")) if (!$util.isString(message.persistenceIamIdentity)) return "persistenceIamIdentity: string expected"; + if (message.connectMode != null && message.hasOwnProperty("connectMode")) + switch (message.connectMode) { + default: + return "connectMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -5482,6 +5594,20 @@ message.authorizedNetwork = String(object.authorizedNetwork); if (object.persistenceIamIdentity != null) message.persistenceIamIdentity = String(object.persistenceIamIdentity); + switch (object.connectMode) { + case "CONNECT_MODE_UNSPECIFIED": + case 0: + message.connectMode = 0; + break; + case "DIRECT_PEERING": + case 1: + message.connectMode = 1; + break; + case "PRIVATE_SERVICE_ACCESS": + case 2: + message.connectMode = 2; + break; + } return message; }; @@ -5519,6 +5645,7 @@ object.memorySizeGb = 0; object.authorizedNetwork = ""; object.persistenceIamIdentity = ""; + object.connectMode = options.enums === String ? "CONNECT_MODE_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -5563,6 +5690,8 @@ object.authorizedNetwork = message.authorizedNetwork; if (message.persistenceIamIdentity != null && message.hasOwnProperty("persistenceIamIdentity")) object.persistenceIamIdentity = message.persistenceIamIdentity; + if (message.connectMode != null && message.hasOwnProperty("connectMode")) + object.connectMode = options.enums === String ? $root.google.cloud.redis.v1beta1.Instance.ConnectMode[message.connectMode] : message.connectMode; return object; }; @@ -5621,6 +5750,22 @@ return values; })(); + /** + * ConnectMode enum. + * @name google.cloud.redis.v1beta1.Instance.ConnectMode + * @enum {string} + * @property {number} CONNECT_MODE_UNSPECIFIED=0 CONNECT_MODE_UNSPECIFIED value + * @property {number} DIRECT_PEERING=1 DIRECT_PEERING value + * @property {number} PRIVATE_SERVICE_ACCESS=2 PRIVATE_SERVICE_ACCESS value + */ + Instance.ConnectMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONNECT_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DIRECT_PEERING"] = 1; + values[valuesById[2] = "PRIVATE_SERVICE_ACCESS"] = 2; + return values; + })(); + return Instance; })(); @@ -6770,6 +6915,216 @@ return UpdateInstanceRequest; })(); + v1beta1.UpgradeInstanceRequest = (function() { + + /** + * Properties of an UpgradeInstanceRequest. + * @memberof google.cloud.redis.v1beta1 + * @interface IUpgradeInstanceRequest + * @property {string|null} [name] UpgradeInstanceRequest name + * @property {string|null} [redisVersion] UpgradeInstanceRequest redisVersion + */ + + /** + * Constructs a new UpgradeInstanceRequest. + * @memberof google.cloud.redis.v1beta1 + * @classdesc Represents an UpgradeInstanceRequest. + * @implements IUpgradeInstanceRequest + * @constructor + * @param {google.cloud.redis.v1beta1.IUpgradeInstanceRequest=} [properties] Properties to set + */ + function UpgradeInstanceRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpgradeInstanceRequest name. + * @member {string} name + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @instance + */ + UpgradeInstanceRequest.prototype.name = ""; + + /** + * UpgradeInstanceRequest redisVersion. + * @member {string} redisVersion + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @instance + */ + UpgradeInstanceRequest.prototype.redisVersion = ""; + + /** + * Creates a new UpgradeInstanceRequest instance using the specified properties. + * @function create + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @static + * @param {google.cloud.redis.v1beta1.IUpgradeInstanceRequest=} [properties] Properties to set + * @returns {google.cloud.redis.v1beta1.UpgradeInstanceRequest} UpgradeInstanceRequest instance + */ + UpgradeInstanceRequest.create = function create(properties) { + return new UpgradeInstanceRequest(properties); + }; + + /** + * Encodes the specified UpgradeInstanceRequest message. Does not implicitly {@link google.cloud.redis.v1beta1.UpgradeInstanceRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @static + * @param {google.cloud.redis.v1beta1.IUpgradeInstanceRequest} message UpgradeInstanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpgradeInstanceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.redisVersion != null && message.hasOwnProperty("redisVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.redisVersion); + return writer; + }; + + /** + * Encodes the specified UpgradeInstanceRequest message, length delimited. Does not implicitly {@link google.cloud.redis.v1beta1.UpgradeInstanceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @static + * @param {google.cloud.redis.v1beta1.IUpgradeInstanceRequest} message UpgradeInstanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpgradeInstanceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpgradeInstanceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.redis.v1beta1.UpgradeInstanceRequest} UpgradeInstanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpgradeInstanceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.redis.v1beta1.UpgradeInstanceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.redisVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpgradeInstanceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.redis.v1beta1.UpgradeInstanceRequest} UpgradeInstanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpgradeInstanceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpgradeInstanceRequest message. + * @function verify + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpgradeInstanceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.redisVersion != null && message.hasOwnProperty("redisVersion")) + if (!$util.isString(message.redisVersion)) + return "redisVersion: string expected"; + return null; + }; + + /** + * Creates an UpgradeInstanceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.redis.v1beta1.UpgradeInstanceRequest} UpgradeInstanceRequest + */ + UpgradeInstanceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.redis.v1beta1.UpgradeInstanceRequest) + return object; + var message = new $root.google.cloud.redis.v1beta1.UpgradeInstanceRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.redisVersion != null) + message.redisVersion = String(object.redisVersion); + return message; + }; + + /** + * Creates a plain object from an UpgradeInstanceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @static + * @param {google.cloud.redis.v1beta1.UpgradeInstanceRequest} message UpgradeInstanceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpgradeInstanceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.redisVersion = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.redisVersion != null && message.hasOwnProperty("redisVersion")) + object.redisVersion = message.redisVersion; + return object; + }; + + /** + * Converts this UpgradeInstanceRequest to JSON. + * @function toJSON + * @memberof google.cloud.redis.v1beta1.UpgradeInstanceRequest + * @instance + * @returns {Object.} JSON object + */ + UpgradeInstanceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpgradeInstanceRequest; + })(); + v1beta1.DeleteInstanceRequest = (function() { /** diff --git a/packages/google-cloud-redis/protos/protos.json b/packages/google-cloud-redis/protos/protos.json index 7b1555bfe17..2e5b54293c4 100644 --- a/packages/google-cloud-redis/protos/protos.json +++ b/packages/google-cloud-redis/protos/protos.json @@ -230,6 +230,13 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "connectMode": { + "type": "ConnectMode", + "id": 22, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } }, "nested": { @@ -252,6 +259,13 @@ "BASIC": 1, "STANDARD_HA": 3 } + }, + "ConnectMode": { + "values": { + "CONNECT_MODE_UNSPECIFIED": 0, + "DIRECT_PEERING": 1, + "PRIVATE_SERVICE_ACCESS": 2 + } } } }, @@ -578,6 +592,17 @@ "(google.longrunning.operation_info).metadata_type": "google.protobuf.Any" } }, + "UpgradeInstance": { + "requestType": "UpgradeInstanceRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta1/{name=projects/*/locations/*/instances/*}:upgrade", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,redis_version", + "(google.longrunning.operation_info).response_type": "google.cloud.redis.v1beta1.Instance", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Any" + } + }, "ImportInstance": { "requestType": "ImportInstanceRequest", "responseType": "google.longrunning.Operation", @@ -750,6 +775,13 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "connectMode": { + "type": "ConnectMode", + "id": 22, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } }, "nested": { @@ -772,6 +804,13 @@ "BASIC": 1, "STANDARD_HA": 3 } + }, + "ConnectMode": { + "values": { + "CONNECT_MODE_UNSPECIFIED": 0, + "DIRECT_PEERING": 1, + "PRIVATE_SERVICE_ACCESS": 2 + } } } }, @@ -869,6 +908,25 @@ } } }, + "UpgradeInstanceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "redis.googleapis.com/Instance" + } + }, + "redisVersion": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, "DeleteInstanceRequest": { "fields": { "name": { diff --git a/packages/google-cloud-redis/src/v1/cloud_redis_client.ts b/packages/google-cloud-redis/src/v1/cloud_redis_client.ts index 53eb3c1f3e3..3487b65d83a 100644 --- a/packages/google-cloud-redis/src/v1/cloud_redis_client.ts +++ b/packages/google-cloud-redis/src/v1/cloud_redis_client.ts @@ -158,12 +158,12 @@ export class CloudRedisClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - locationPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), instancePathTemplate: new gaxModule.PathTemplate( 'projects/{project}/locations/{location}/instances/{instance}' ), + locationPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), }; // Some of the methods on this service return "paged" results, @@ -600,7 +600,7 @@ export class CloudRedisClient { * @param {google.protobuf.FieldMask} request.updateMask * 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` @@ -659,7 +659,7 @@ export class CloudRedisClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - instance_name: request.instance!.name || '', + 'instance.name': request.instance!.name || '', }); return this._innerApiCalls.updateInstance(request, options, callback); } @@ -1060,6 +1060,7 @@ export class CloudRedisClient { * 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 @@ -1077,11 +1078,11 @@ export class CloudRedisClient { * 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. * @param {string} request.pageToken - * 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. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1165,11 +1166,11 @@ export class CloudRedisClient { * 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. * @param {string} request.pageToken - * 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. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -1177,9 +1178,17 @@ export class CloudRedisClient { */ listInstancesStream( request?: protosTypes.google.cloud.redis.v1.IListInstancesRequest, - options?: gax.CallOptions | {} + options?: gax.CallOptions ): Transform { request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); return this._descriptors.page.listInstances.createStream( this._innerApiCalls.listInstances as gax.GaxCall, @@ -1191,43 +1200,6 @@ export class CloudRedisClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project: string, location: string) { - return this._pathTemplates.locationPathTemplate.render({ - project, - location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this._pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this._pathTemplates.locationPathTemplate.match(locationName) - .location; - } - /** * Return a fully-qualified instance resource name string. * @@ -1279,6 +1251,43 @@ export class CloudRedisClient { .instance; } + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this._pathTemplates.locationPathTemplate.render({ + project, + location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName) + .location; + } + /** * Terminate the GRPC channel and close the client. * diff --git a/packages/google-cloud-redis/src/v1beta1/cloud_redis_client.ts b/packages/google-cloud-redis/src/v1beta1/cloud_redis_client.ts index b9e66e5f84f..4502bf5ce3e 100644 --- a/packages/google-cloud-redis/src/v1beta1/cloud_redis_client.ts +++ b/packages/google-cloud-redis/src/v1beta1/cloud_redis_client.ts @@ -158,12 +158,12 @@ export class CloudRedisClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - locationPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), instancePathTemplate: new gaxModule.PathTemplate( 'projects/{project}/locations/{location}/instances/{instance}' ), + locationPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), }; // Some of the methods on this service return "paged" results, @@ -202,6 +202,12 @@ export class CloudRedisClient { const updateInstanceMetadata = protoFilesRoot.lookup( '.google.protobuf.Any' ) as gax.protobuf.Type; + const upgradeInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.redis.v1beta1.Instance' + ) as gax.protobuf.Type; + const upgradeInstanceMetadata = protoFilesRoot.lookup( + '.google.protobuf.Any' + ) as gax.protobuf.Type; const importInstanceResponse = protoFilesRoot.lookup( '.google.cloud.redis.v1beta1.Instance' ) as gax.protobuf.Type; @@ -238,6 +244,11 @@ export class CloudRedisClient { updateInstanceResponse.decode.bind(updateInstanceResponse), updateInstanceMetadata.decode.bind(updateInstanceMetadata) ), + upgradeInstance: new gaxModule.LongrunningDescriptor( + this.operationsClient, + upgradeInstanceResponse.decode.bind(upgradeInstanceResponse), + upgradeInstanceMetadata.decode.bind(upgradeInstanceMetadata) + ), importInstance: new gaxModule.LongrunningDescriptor( this.operationsClient, importInstanceResponse.decode.bind(importInstanceResponse), @@ -292,6 +303,7 @@ export class CloudRedisClient { 'getInstance', 'createInstance', 'updateInstance', + 'upgradeInstance', 'importInstance', 'exportInstance', 'failoverInstance', @@ -660,10 +672,101 @@ export class CloudRedisClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - instance_name: request.instance!.name || '', + 'instance.name': request.instance!.name || '', }); return this._innerApiCalls.updateInstance(request, options, callback); } + upgradeInstance( + request: protosTypes.google.cloud.redis.v1beta1.IUpgradeInstanceRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.redis.v1beta1.IInstance, + protosTypes.google.protobuf.IAny + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + upgradeInstance( + request: protosTypes.google.cloud.redis.v1beta1.IUpgradeInstanceRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.redis.v1beta1.IInstance, + protosTypes.google.protobuf.IAny + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Upgrades Redis instance to the newer Redis version specified in the + * request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * 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. + * @param {string} request.redisVersion + * Required. Specifies the target version of Redis software to upgrade to. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + upgradeInstance( + request: protosTypes.google.cloud.redis.v1beta1.IUpgradeInstanceRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.redis.v1beta1.IInstance, + protosTypes.google.protobuf.IAny + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.redis.v1beta1.IInstance, + protosTypes.google.protobuf.IAny + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.redis.v1beta1.IInstance, + protosTypes.google.protobuf.IAny + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.upgradeInstance(request, options, callback); + } importInstance( request: protosTypes.google.cloud.redis.v1beta1.IImportInstanceRequest, options?: gax.CallOptions @@ -1061,6 +1164,7 @@ export class CloudRedisClient { * 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 @@ -1078,11 +1182,11 @@ export class CloudRedisClient { * 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. * @param {string} request.pageToken - * 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. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1166,11 +1270,11 @@ export class CloudRedisClient { * 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. * @param {string} request.pageToken - * 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. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -1178,9 +1282,17 @@ export class CloudRedisClient { */ listInstancesStream( request?: protosTypes.google.cloud.redis.v1beta1.IListInstancesRequest, - options?: gax.CallOptions | {} + options?: gax.CallOptions ): Transform { request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); return this._descriptors.page.listInstances.createStream( this._innerApiCalls.listInstances as gax.GaxCall, @@ -1192,43 +1304,6 @@ export class CloudRedisClient { // -- Path templates -- // -------------------- - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project: string, location: string) { - return this._pathTemplates.locationPathTemplate.render({ - project, - location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this._pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this._pathTemplates.locationPathTemplate.match(locationName) - .location; - } - /** * Return a fully-qualified instance resource name string. * @@ -1280,6 +1355,43 @@ export class CloudRedisClient { .instance; } + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this._pathTemplates.locationPathTemplate.render({ + project, + location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName) + .location; + } + /** * Terminate the GRPC channel and close the client. * diff --git a/packages/google-cloud-redis/src/v1beta1/cloud_redis_client_config.json b/packages/google-cloud-redis/src/v1beta1/cloud_redis_client_config.json index bc798a4f158..28f7aa946f9 100644 --- a/packages/google-cloud-redis/src/v1beta1/cloud_redis_client_config.json +++ b/packages/google-cloud-redis/src/v1beta1/cloud_redis_client_config.json @@ -36,6 +36,10 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "UpgradeInstance": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ImportInstance": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" diff --git a/packages/google-cloud-redis/synth.metadata b/packages/google-cloud-redis/synth.metadata index ce6851d3603..3eeb80b75ee 100644 --- a/packages/google-cloud-redis/synth.metadata +++ b/packages/google-cloud-redis/synth.metadata @@ -1,20 +1,20 @@ { - "updateTime": "2020-01-28T12:31:30.939777Z", + "updateTime": "2020-02-07T12:33:42.050468Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8e981acfd9b97ea2f312f11bbaa7b6c16e412dea", - "internalRef": "291821782", - "log": "8e981acfd9b97ea2f312f11bbaa7b6c16e412dea\nBeta launch for PersonDetection and FaceDetection features.\n\nPiperOrigin-RevId: 291821782\n\n994e067fae3b21e195f7da932b08fff806d70b5d\nasset: add annotations to v1p2beta1\n\nPiperOrigin-RevId: 291815259\n\n244e1d2c89346ca2e0701b39e65552330d68545a\nAdd Playable Locations service\n\nPiperOrigin-RevId: 291806349\n\n909f8f67963daf45dd88d020877fb9029b76788d\nasset: add annotations to v1beta2\n\nPiperOrigin-RevId: 291805301\n\n" + "sha": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585", + "internalRef": "293710856", + "log": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585\nGenerate the Bazel build file for recommendengine public api\n\nPiperOrigin-RevId: 293710856\n\n68477017c4173c98addac0373950c6aa9d7b375f\nMake `language_code` optional for UpdateIntentRequest and BatchUpdateIntentsRequest.\n\nThe comments and proto annotations describe this parameter as optional.\n\nPiperOrigin-RevId: 293703548\n\n16f823f578bca4e845a19b88bb9bc5870ea71ab2\nAdd BUILD.bazel files for managedidentities API\n\nPiperOrigin-RevId: 293698246\n\n2f53fd8178c9a9de4ad10fae8dd17a7ba36133f2\nAdd v1p1beta1 config file\n\nPiperOrigin-RevId: 293696729\n\n052b274138fce2be80f97b6dcb83ab343c7c8812\nAdd source field for user event and add field behavior annotations\n\nPiperOrigin-RevId: 293693115\n\n1e89732b2d69151b1b3418fff3d4cc0434f0dded\ndatacatalog: v1beta1 add three new RPCs to gapic v1beta1 config\n\nPiperOrigin-RevId: 293692823\n\n9c8bd09bbdc7c4160a44f1fbab279b73cd7a2337\nchange the name of AccessApproval service to AccessApprovalAdmin\n\nPiperOrigin-RevId: 293690934\n\n2e23b8fbc45f5d9e200572ca662fe1271bcd6760\nAdd ListEntryGroups method, add http bindings to support entry group tagging, and update some comments.\n\nPiperOrigin-RevId: 293666452\n\n0275e38a4ca03a13d3f47a9613aac8c8b0d3f1f2\nAdd proto_package field to managedidentities API. It is needed for APIs that still depend on artman generation.\n\nPiperOrigin-RevId: 293643323\n\n4cdfe8278cb6f308106580d70648001c9146e759\nRegenerating public protos for Data Catalog to add new Custom Type Entry feature.\n\nPiperOrigin-RevId: 293614782\n\n45d2a569ab526a1fad3720f95eefb1c7330eaada\nEnable client generation for v1 ManagedIdentities API.\n\nPiperOrigin-RevId: 293515675\n\n2c17086b77e6f3bcf04a1f65758dfb0c3da1568f\nAdd the Actions on Google common types (//google/actions/type/*).\n\nPiperOrigin-RevId: 293478245\n\n781aadb932e64a12fb6ead7cd842698d99588433\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293443396\n\ne2602608c9138c2fca24162720e67f9307c30b95\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293442964\n\nc8aef82028d06b7992278fa9294c18570dc86c3d\nAdd cc_proto_library and cc_grpc_library targets for Bigtable protos.\n\nAlso fix indentation of cc_grpc_library targets in Spanner and IAM protos.\n\nPiperOrigin-RevId: 293440538\n\ne2faab04f4cb7f9755072330866689b1943a16e9\ncloudtasks: v2 replace non-standard retry params in gapic config v2\n\nPiperOrigin-RevId: 293424055\n\ndfb4097ea628a8470292c6590a4313aee0c675bd\nerrorreporting: v1beta1 add legacy artman config for php\n\nPiperOrigin-RevId: 293423790\n\nb18aed55b45bfe5b62476292c72759e6c3e573c6\nasset: v1p1beta1 updated comment for `page_size` limit.\n\nPiperOrigin-RevId: 293421386\n\nc9ef36b7956d9859a2fc86ad35fcaa16958ab44f\nbazel: Refactor CI build scripts\n\nPiperOrigin-RevId: 293387911\n\na8ed9d921fdddc61d8467bfd7c1668f0ad90435c\nfix: set Ruby module name for OrgPolicy\n\nPiperOrigin-RevId: 293257997\n\n6c7d28509bd8315de8af0889688ee20099594269\nredis: v1beta1 add UpgradeInstance and connect_mode field to Instance\n\nPiperOrigin-RevId: 293242878\n\nae0abed4fcb4c21f5cb67a82349a049524c4ef68\nredis: v1 add connect_mode field to Instance\n\nPiperOrigin-RevId: 293241914\n\n3f7a0d29b28ee9365771da2b66edf7fa2b4e9c56\nAdds service config definition for bigqueryreservation v1beta1\n\nPiperOrigin-RevId: 293234418\n\n0c88168d5ed6fe353a8cf8cbdc6bf084f6bb66a5\naddition of BUILD & configuration for accessapproval v1\n\nPiperOrigin-RevId: 293219198\n\n39bedc2e30f4778ce81193f6ba1fec56107bcfc4\naccessapproval: v1 publish protos\n\nPiperOrigin-RevId: 293167048\n\n69d9945330a5721cd679f17331a78850e2618226\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080182\n\nf6a1a6b417f39694275ca286110bc3c1ca4db0dc\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080178\n\n29d40b78e3dc1579b0b209463fbcb76e5767f72a\nExpose managedidentities/v1beta1/ API for client library usage.\n\nPiperOrigin-RevId: 292979741\n\na22129a1fb6e18056d576dfb7717aef74b63734a\nExpose managedidentities/v1/ API for client library usage.\n\nPiperOrigin-RevId: 292968186\n\nb5cbe4a4ba64ab19e6627573ff52057a1657773d\nSecurityCenter v1p1beta1: move file-level option on top to workaround protobuf.js bug.\n\nPiperOrigin-RevId: 292647187\n\nb224b317bf20c6a4fbc5030b4a969c3147f27ad3\nAdds API definitions for bigqueryreservation v1beta1.\n\nPiperOrigin-RevId: 292634722\n\nc1468702f9b17e20dd59007c0804a089b83197d2\nSynchronize new proto/yaml changes.\n\nPiperOrigin-RevId: 292626173\n\nffdfa4f55ab2f0afc11d0eb68f125ccbd5e404bd\nvision: v1p3beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292605599\n\n78f61482cd028fc1d9892aa5d89d768666a954cd\nvision: v1p1beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292605125\n\n60bb5a294a604fd1778c7ec87b265d13a7106171\nvision: v1p2beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292604980\n\n3bcf7aa79d45eb9ec29ab9036e9359ea325a7fc3\nvision: v1p4beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292604656\n\n2717b8a1c762b26911b45ecc2e4ee01d98401b28\nFix dataproc artman client library generation.\n\nPiperOrigin-RevId: 292555664\n\n7ac66d9be8a7d7de4f13566d8663978c9ee9dcd7\nAdd Dataproc Autoscaling API to V1.\n\nPiperOrigin-RevId: 292450564\n\n5d932b2c1be3a6ef487d094e3cf5c0673d0241dd\n- Improve documentation\n- Add a client_id field to StreamingPullRequest\n\nPiperOrigin-RevId: 292434036\n\neaff9fa8edec3e914995ce832b087039c5417ea7\nmonitoring: v3 publish annotations and client retry config\n\nPiperOrigin-RevId: 292425288\n\n70958bab8c5353870d31a23fb2c40305b050d3fe\nBigQuery Storage Read API v1 clients.\n\nPiperOrigin-RevId: 292407644\n\n7a15e7fe78ff4b6d5c9606a3264559e5bde341d1\nUpdate backend proto for Google Cloud Endpoints\n\nPiperOrigin-RevId: 292391607\n\n3ca2c014e24eb5111c8e7248b1e1eb833977c83d\nbazel: Add --flaky_test_attempts=3 argument to prevent CI failures caused by flaky tests\n\nPiperOrigin-RevId: 292382559\n\n9933347c1f677e81e19a844c2ef95bfceaf694fe\nbazel:Integrate latest protoc-java-resource-names-plugin changes (fix for PyYAML dependency in bazel rules)\n\nPiperOrigin-RevId: 292376626\n\nb835ab9d2f62c88561392aa26074c0b849fb0bd3\nasset: v1p2beta1 add client config annotations\n\n* remove unintentionally exposed RPCs\n* remove messages relevant to removed RPCs\n\nPiperOrigin-RevId: 292369593\n\nc1246a29e22b0f98e800a536b5b0da2d933a55f2\nUpdating v1 protos with the latest inline documentation (in comments) and config options. Also adding a per-service .yaml file.\n\nPiperOrigin-RevId: 292310790\n\nb491d07cadaae7cde5608321f913e5ca1459b32d\nRevert accidental local_repository change\n\nPiperOrigin-RevId: 292245373\n\naf3400a8cb6110025198b59a0f7d018ae3cda700\nUpdate gapic-generator dependency (prebuilt PHP binary support).\n\nPiperOrigin-RevId: 292243997\n\n341fd5690fae36f36cf626ef048fbcf4bbe7cee6\ngrafeas: v1 add resource_definition for the grafeas.io/Project and change references for Project.\n\nPiperOrigin-RevId: 292221998\n\n42e915ec2ece1cd37a590fbcd10aa2c0fb0e5b06\nUpdate the gapic-generator, protoc-java-resource-name-plugin and protoc-docs-plugin to the latest commit.\n\nPiperOrigin-RevId: 292182368\n\nf035f47250675d31492a09f4a7586cfa395520a7\nFix grafeas build and update build.sh script to include gerafeas.\n\nPiperOrigin-RevId: 292168753\n\n26ccb214b7bc4a716032a6266bcb0a9ca55d6dbb\nasset: v1p1beta1 add client config annotations and retry config\n\nPiperOrigin-RevId: 292154210\n\n974ee5c0b5d03e81a50dafcedf41e0efebb5b749\nasset: v1beta1 add client config annotations\n\nPiperOrigin-RevId: 292152573\n\ncf3b61102ed5f36b827bc82ec39be09525f018c8\n Fix to protos for v1p1beta1 release of Cloud Security Command Center\n\nPiperOrigin-RevId: 292034635\n\n4e1cfaa7c0fede9e65d64213ca3da1b1255816c0\nUpdate the public proto to support UTF-8 encoded id for CatalogService API, increase the ListCatalogItems deadline to 300s and some minor documentation change\n\nPiperOrigin-RevId: 292030970\n\n9c483584f8fd5a1b862ae07973f4cc7bb3e46648\nasset: add annotations to v1p1beta1\n\nPiperOrigin-RevId: 292009868\n\ne19209fac29731d0baf6d9ac23da1164f7bdca24\nAdd the google.rpc.context.AttributeContext message to the open source\ndirectories.\n\nPiperOrigin-RevId: 291999930\n\nae5662960573f279502bf98a108a35ba1175e782\noslogin API: move file level option on top of the file to avoid protobuf.js bug.\n\nPiperOrigin-RevId: 291990506\n\neba3897fff7c49ed85d3c47fc96fe96e47f6f684\nAdd cc_proto_library and cc_grpc_library targets for Spanner and IAM protos.\n\nPiperOrigin-RevId: 291988651\n\n" } }, { "template": { "name": "node_library", "origin": "synthtool.gcp", - "version": "2019.10.17" + "version": "2020.2.4" } } ], @@ -37,283 +37,5 @@ "generator": "gapic-generator-typescript" } } - ], - "newFiles": [ - { - "path": ".eslintignore" - }, - { - "path": ".eslintrc.yml" - }, - { - "path": ".github/ISSUE_TEMPLATE/bug_report.md" - }, - { - "path": ".github/ISSUE_TEMPLATE/feature_request.md" - }, - { - "path": ".github/ISSUE_TEMPLATE/support_request.md" - }, - { - "path": ".github/PULL_REQUEST_TEMPLATE.md" - }, - { - "path": ".github/release-please.yml" - }, - { - "path": ".gitignore" - }, - { - "path": ".jsdoc.js" - }, - { - "path": ".kokoro/.gitattributes" - }, - { - "path": ".kokoro/common.cfg" - }, - { - "path": ".kokoro/continuous/node10/common.cfg" - }, - { - "path": ".kokoro/continuous/node10/docs.cfg" - }, - { - "path": ".kokoro/continuous/node10/lint.cfg" - }, - { - "path": ".kokoro/continuous/node10/samples-test.cfg" - }, - { - "path": ".kokoro/continuous/node10/system-test.cfg" - }, - { - "path": ".kokoro/continuous/node10/test.cfg" - }, - { - "path": ".kokoro/continuous/node12/common.cfg" - }, - { - "path": ".kokoro/continuous/node12/test.cfg" - }, - { - "path": ".kokoro/continuous/node8/common.cfg" - }, - { - "path": ".kokoro/continuous/node8/test.cfg" - }, - { - "path": ".kokoro/docs.sh" - }, - { - "path": ".kokoro/lint.sh" - }, - { - "path": ".kokoro/presubmit/node10/common.cfg" - }, - { - "path": ".kokoro/presubmit/node10/docs.cfg" - }, - { - "path": ".kokoro/presubmit/node10/lint.cfg" - }, - { - "path": ".kokoro/presubmit/node10/samples-test.cfg" - }, - { - "path": ".kokoro/presubmit/node10/system-test.cfg" - }, - { - "path": ".kokoro/presubmit/node10/test.cfg" - }, - { - "path": ".kokoro/presubmit/node12/common.cfg" - }, - { - "path": ".kokoro/presubmit/node12/test.cfg" - }, - { - "path": ".kokoro/presubmit/node8/common.cfg" - }, - { - "path": ".kokoro/presubmit/node8/test.cfg" - }, - { - "path": ".kokoro/presubmit/windows/common.cfg" - }, - { - "path": ".kokoro/presubmit/windows/test.cfg" - }, - { - "path": ".kokoro/publish.sh" - }, - { - "path": ".kokoro/release/common.cfg" - }, - { - "path": ".kokoro/release/docs.cfg" - }, - { - "path": ".kokoro/release/docs.sh" - }, - { - "path": ".kokoro/release/publish.cfg" - }, - { - "path": ".kokoro/samples-test.sh" - }, - { - "path": ".kokoro/system-test.sh" - }, - { - "path": ".kokoro/test.bat" - }, - { - "path": ".kokoro/test.sh" - }, - { - "path": ".kokoro/trampoline.sh" - }, - { - "path": ".nycrc" - }, - { - "path": ".prettierignore" - }, - { - "path": ".prettierrc" - }, - { - "path": ".repo-metadata.json" - }, - { - "path": "CHANGELOG.md" - }, - { - "path": "CODE_OF_CONDUCT.md" - }, - { - "path": "CONTRIBUTING.md" - }, - { - "path": "LICENSE" - }, - { - "path": "README.md" - }, - { - "path": "codecov.yaml" - }, - { - "path": "linkinator.config.json" - }, - { - "path": "package.json" - }, - { - "path": "protos/google/cloud/common_resources.proto" - }, - { - "path": "protos/google/cloud/redis/v1/cloud_redis.proto" - }, - { - "path": "protos/google/cloud/redis/v1beta1/cloud_redis.proto" - }, - { - "path": "protos/protos.d.ts" - }, - { - "path": "protos/protos.js" - }, - { - "path": "protos/protos.json" - }, - { - "path": "renovate.json" - }, - { - "path": "samples/.eslintrc.yml" - }, - { - "path": "samples/README.md" - }, - { - "path": "samples/package.json" - }, - { - "path": "samples/quickstart.js" - }, - { - "path": "samples/system-test/.eslintrc.yml" - }, - { - "path": "samples/system-test/redis.js" - }, - { - "path": "src/index.ts" - }, - { - "path": "src/v1/cloud_redis_client.ts" - }, - { - "path": "src/v1/cloud_redis_client_config.json" - }, - { - "path": "src/v1/cloud_redis_proto_list.json" - }, - { - "path": "src/v1/index.ts" - }, - { - "path": "src/v1beta1/cloud_redis_client.ts" - }, - { - "path": "src/v1beta1/cloud_redis_client_config.json" - }, - { - "path": "src/v1beta1/cloud_redis_proto_list.json" - }, - { - "path": "src/v1beta1/index.ts" - }, - { - "path": "synth.metadata" - }, - { - "path": "synth.py" - }, - { - "path": "system-test/fixtures/sample/src/index.js" - }, - { - "path": "system-test/fixtures/sample/src/index.ts" - }, - { - "path": "system-test/install.ts" - }, - { - "path": "system-test/system.js" - }, - { - "path": "test/.eslintrc.yml" - }, - { - "path": "test/gapic-cloud_redis-v1.ts" - }, - { - "path": "test/gapic-cloud_redis-v1beta1.ts" - }, - { - "path": "test/mocha.opts" - }, - { - "path": "tsconfig.json" - }, - { - "path": "tslint.json" - }, - { - "path": "webpack.config.js" - } ] } \ No newline at end of file diff --git a/packages/google-cloud-redis/test/gapic-cloud_redis-v1.ts b/packages/google-cloud-redis/test/gapic-cloud_redis-v1.ts index 1ab2a51dd68..97cecda667d 100644 --- a/packages/google-cloud-redis/test/gapic-cloud_redis-v1.ts +++ b/packages/google-cloud-redis/test/gapic-cloud_redis-v1.ts @@ -110,6 +110,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IGetInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -132,6 +133,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IGetInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -156,6 +158,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.ICreateInstanceRequest = {}; + request.parent = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -185,6 +188,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.ICreateInstanceRequest = {}; + request.parent = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -282,6 +286,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IImportInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -311,6 +316,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IImportInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -343,6 +349,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IExportInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -372,6 +379,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IExportInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -404,6 +412,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IFailoverInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -433,6 +442,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IFailoverInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -465,6 +475,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IDeleteInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -494,6 +505,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IDeleteInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -526,6 +538,7 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IListInstancesRequest = {}; + request.parent = ''; // Mock response const expectedResponse = {}; // Mock Grpc layer @@ -552,8 +565,9 @@ describe('v1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1.IListInstancesRequest = {}; + request.parent = ''; // Mock response - const expectedResponse = {}; + const expectedResponse = {response: 'data'}; // Mock Grpc layer client._innerApiCalls.listInstances = ( actualRequest: {}, @@ -572,7 +586,7 @@ describe('v1.CloudRedisClient', () => { .on('error', (err: FakeError) => { done(err); }); - stream.write(request); + stream.write(expectedResponse); }); }); }); diff --git a/packages/google-cloud-redis/test/gapic-cloud_redis-v1beta1.ts b/packages/google-cloud-redis/test/gapic-cloud_redis-v1beta1.ts index 3bc6c8e757b..67249b7a7f5 100644 --- a/packages/google-cloud-redis/test/gapic-cloud_redis-v1beta1.ts +++ b/packages/google-cloud-redis/test/gapic-cloud_redis-v1beta1.ts @@ -110,6 +110,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IGetInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -132,6 +133,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IGetInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -156,6 +158,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.ICreateInstanceRequest = {}; + request.parent = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -185,6 +188,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.ICreateInstanceRequest = {}; + request.parent = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -274,6 +278,69 @@ describe('v1beta1.CloudRedisClient', () => { }); }); }); + describe('upgradeInstance', () => { + it('invokes upgradeInstance without error', done => { + const client = new cloudredisModule.v1beta1.CloudRedisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.redis.v1beta1.IUpgradeInstanceRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.upgradeInstance = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .upgradeInstance(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes upgradeInstance with error', done => { + const client = new cloudredisModule.v1beta1.CloudRedisClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.redis.v1beta1.IUpgradeInstanceRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.upgradeInstance = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .upgradeInstance(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); describe('importInstance', () => { it('invokes importInstance without error', done => { const client = new cloudredisModule.v1beta1.CloudRedisClient({ @@ -282,6 +349,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IImportInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -311,6 +379,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IImportInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -343,6 +412,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IExportInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -372,6 +442,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IExportInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -404,6 +475,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IFailoverInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -433,6 +505,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IFailoverInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -465,6 +538,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IDeleteInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -494,6 +568,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IDeleteInstanceRequest = {}; + request.name = ''; // Mock response const expectedResponse = {}; // Mock gRPC layer @@ -526,6 +601,7 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IListInstancesRequest = {}; + request.parent = ''; // Mock response const expectedResponse = {}; // Mock Grpc layer @@ -552,8 +628,9 @@ describe('v1beta1.CloudRedisClient', () => { }); // Mock request const request: protosTypes.google.cloud.redis.v1beta1.IListInstancesRequest = {}; + request.parent = ''; // Mock response - const expectedResponse = {}; + const expectedResponse = {response: 'data'}; // Mock Grpc layer client._innerApiCalls.listInstances = ( actualRequest: {}, @@ -572,7 +649,7 @@ describe('v1beta1.CloudRedisClient', () => { .on('error', (err: FakeError) => { done(err); }); - stream.write(request); + stream.write(expectedResponse); }); }); });