From df539e665fe5d8fe01084b8d8cf6094c89b13d48 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:36:21 +0530 Subject: [PATCH] feat(spanner): Add resource reference annotation to backup schedules (#2093) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(spanner): add edition field to the instance proto PiperOrigin-RevId: 662226829 Source-Link: https://github.com/googleapis/googleapis/commit/eb87f475f5f1a5b5ae7de7fbdc9bc822ca1e87b4 Source-Link: https://github.com/googleapis/googleapis-gen/commit/0fb784e8267f0931d24f152ec5f66e809c2a2efb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGZiNzg0ZTgyNjdmMDkzMWQyNGYxNTJlYzVmNjZlODA5YzJhMmVmYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat(spanner): Add resource reference annotation to backup schedules docs(spanner): Add an example to filter backups based on schedule name PiperOrigin-RevId: 662402292 Source-Link: https://github.com/googleapis/googleapis/commit/96facece981f227c5d54133845fc519f73900b8e Source-Link: https://github.com/googleapis/googleapis-gen/commit/fe33f1c61415aef4e70f491dfb8789a68e8d9083 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmUzM2YxYzYxNDE1YWVmNGU3MGY0OTFkZmI4Nzg5YTY4ZThkOTA4MyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .gitignore | 1 - .../spanner/admin/database/v1/backup.proto | 11 +- .../instance/v1/spanner_instance_admin.proto | 265 ++++-- protos/protos.d.ts | 338 ++++++++ protos/protos.js | 765 ++++++++++++++++++ protos/protos.json | 81 +- src/v1/database_admin_client.ts | 9 + src/v1/instance_admin_client.ts | 295 ++++++- src/v1/instance_admin_client_config.json | 4 + test/gapic_instance_admin_v1.ts | 190 +++++ 10 files changed, 1850 insertions(+), 109 deletions(-) diff --git a/.gitignore b/.gitignore index 14050d4e4..d4f03a0df 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ system-test/*key.json .DS_Store package-lock.json __pycache__ -.vscode \ No newline at end of file diff --git a/protos/google/spanner/admin/database/v1/backup.proto b/protos/google/spanner/admin/database/v1/backup.proto index 842ab0ff1..f3473f4ea 100644 --- a/protos/google/spanner/admin/database/v1/backup.proto +++ b/protos/google/spanner/admin/database/v1/backup.proto @@ -184,8 +184,12 @@ message Backup { // the list of all backup schedule URIs that are associated with creating // this backup. If collapsing is not done, then this field captures the // single backup schedule URI associated with creating this backup. - repeated string backup_schedules = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; + repeated string backup_schedules = 14 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/BackupSchedule" + } + ]; // Output only. Populated only for backups in an incremental backup chain. // Backups share the same chain id if and only if they belong to the same @@ -426,6 +430,7 @@ message ListBackupsRequest { // * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) // * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) // * `size_bytes` + // * `backup_schedules` // // You can combine multiple expressions by enclosing each expression in // parentheses. By default, expressions are combined with AND logic, but @@ -444,6 +449,8 @@ message ListBackupsRequest { // * `expire_time < \"2018-03-28T14:50:00Z\"` // - The backup `expire_time` is before 2018-03-28T14:50:00Z. // * `size_bytes > 10000000000` - The backup's size is greater than 10GB + // * `backup_schedules:daily` + // - The backup is created from a schedule with "daily" in its name. string filter = 2; // Number of backups to be returned in the response. If 0 or diff --git a/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto b/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto index 499bd8603..b8c49260a 100644 --- a/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +++ b/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto @@ -80,38 +80,38 @@ service InstanceAdmin { option (google.api.method_signature) = "name"; } - // Creates an instance config and begins preparing it to be used. The + // Creates an instance configuration and begins preparing it to be used. The // returned [long-running operation][google.longrunning.Operation] // can be used to track the progress of preparing the new - // instance config. The instance config name is assigned by the caller. If the - // named instance config already exists, `CreateInstanceConfig` returns - // `ALREADY_EXISTS`. + // instance configuration. The instance configuration name is assigned by the + // caller. If the named instance configuration already exists, + // `CreateInstanceConfig` returns `ALREADY_EXISTS`. // // Immediately after the request returns: // - // * The instance config is readable via the API, with all requested - // attributes. The instance config's + // * The instance configuration is readable via the API, with all requested + // attributes. The instance configuration's // [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] // field is set to true. Its state is `CREATING`. // // While the operation is pending: // - // * Cancelling the operation renders the instance config immediately + // * Cancelling the operation renders the instance configuration immediately // unreadable via the API. // * Except for deleting the creating resource, all other attempts to modify - // the instance config are rejected. + // the instance configuration are rejected. // // Upon completion of the returned operation: // // * Instances can be created using the instance configuration. - // * The instance config's + // * The instance configuration's // [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] // field becomes false. Its state becomes `READY`. // // The returned [long-running operation][google.longrunning.Operation] will // have a name of the format // `/operations/` and can be used to track - // creation of the instance config. The + // creation of the instance configuration. The // [metadata][google.longrunning.Operation.metadata] field type is // [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. // The [response][google.longrunning.Operation.response] field type is @@ -135,16 +135,16 @@ service InstanceAdmin { }; } - // Updates an instance config. The returned + // Updates an instance configuration. The returned // [long-running operation][google.longrunning.Operation] can be used to track - // the progress of updating the instance. If the named instance config does - // not exist, returns `NOT_FOUND`. + // the progress of updating the instance. If the named instance configuration + // does not exist, returns `NOT_FOUND`. // - // Only user managed configurations can be updated. + // Only user-managed configurations can be updated. // // Immediately after the request returns: // - // * The instance config's + // * The instance configuration's // [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] // field is set to true. // @@ -154,23 +154,23 @@ service InstanceAdmin { // [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]. // The operation is guaranteed to succeed at undoing all changes, after // which point it terminates with a `CANCELLED` status. - // * All other attempts to modify the instance config are rejected. - // * Reading the instance config via the API continues to give the + // * All other attempts to modify the instance configuration are rejected. + // * Reading the instance configuration via the API continues to give the // pre-request values. // // Upon completion of the returned operation: // // * Creating instances using the instance configuration uses the new // values. - // * The instance config's new values are readable via the API. - // * The instance config's + // * The new values of the instance configuration are readable via the API. + // * The instance configuration's // [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] // field becomes false. // // The returned [long-running operation][google.longrunning.Operation] will // have a name of the format // `/operations/` and can be used to track - // the instance config modification. The + // the instance configuration modification. The // [metadata][google.longrunning.Operation.metadata] field type is // [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. // The [response][google.longrunning.Operation.response] field type is @@ -192,11 +192,11 @@ service InstanceAdmin { }; } - // Deletes the instance config. Deletion is only allowed when no + // Deletes the instance configuration. Deletion is only allowed when no // instances are using the configuration. If any instances are using - // the config, returns `FAILED_PRECONDITION`. + // the configuration, returns `FAILED_PRECONDITION`. // - // Only user managed configurations can be deleted. + // Only user-managed configurations can be deleted. // // Authorization requires `spanner.instanceConfigs.delete` permission on // the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. @@ -208,9 +208,9 @@ service InstanceAdmin { option (google.api.method_signature) = "name"; } - // Lists the user-managed instance config [long-running + // Lists the user-managed instance configuration [long-running // operations][google.longrunning.Operation] in the given project. An instance - // config operation has a name of the form + // configuration operation has a name of the form // `projects//instanceConfigs//operations/`. // The long-running operation // [metadata][google.longrunning.Operation.metadata] field type @@ -567,6 +567,78 @@ service InstanceAdmin { }; option (google.api.method_signature) = "parent"; } + + // Moves an instance to the target instance configuration. You can use the + // returned [long-running operation][google.longrunning.Operation] to track + // the progress of moving the instance. + // + // `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of + // the following criteria: + // + // * Is undergoing a move to a different instance configuration + // * Has backups + // * Has an ongoing update + // * Contains any CMEK-enabled databases + // * Is a free trial instance + // + // While the operation is pending: + // + // * All other attempts to modify the instance, including changes to its + // compute capacity, are rejected. + // * The following database and backup admin operations are rejected: + // + // * `DatabaseAdmin.CreateDatabase` + // * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is + // specified in the request.) + // * `DatabaseAdmin.RestoreDatabase` + // * `DatabaseAdmin.CreateBackup` + // * `DatabaseAdmin.CopyBackup` + // + // * Both the source and target instance configurations are subject to + // hourly compute and storage charges. + // * The instance might experience higher read-write latencies and a higher + // transaction abort rate. However, moving an instance doesn't cause any + // downtime. + // + // The returned [long-running operation][google.longrunning.Operation] has + // a name of the format + // `/operations/` and can be used to track + // the move instance operation. The + // [metadata][google.longrunning.Operation.metadata] field type is + // [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. + // The [response][google.longrunning.Operation.response] field type is + // [Instance][google.spanner.admin.instance.v1.Instance], + // if successful. + // Cancelling the operation sets its metadata's + // [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. + // Cancellation is not immediate because it involves moving any data + // previously moved to the target instance configuration back to the original + // instance configuration. You can use this operation to track the progress of + // the cancellation. Upon successful completion of the cancellation, the + // operation terminates with `CANCELLED` status. + // + // If not cancelled, upon completion of the returned operation: + // + // * The instance successfully moves to the target instance + // configuration. + // * You are billed for compute and storage in target instance + // configuration. + // + // Authorization requires the `spanner.instances.update` permission on + // the resource [instance][google.spanner.admin.instance.v1.Instance]. + // + // For more details, see + // [Move an instance](https://cloud.google.com/spanner/docs/move-instance). + rpc MoveInstance(MoveInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/instances/*}:move" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.spanner.admin.instance.v1.MoveInstanceResponse" + metadata_type: "google.spanner.admin.instance.v1.MoveInstanceMetadata" + }; + } } message ReplicaInfo { @@ -637,29 +709,31 @@ message InstanceConfig { USER_MANAGED = 2; } - // Indicates the current state of the instance config. + // Indicates the current state of the instance configuration. enum State { // Not specified. STATE_UNSPECIFIED = 0; - // The instance config is still being created. + // The instance configuration is still being created. CREATING = 1; - // The instance config is fully created and ready to be used to create - // instances. + // The instance configuration is fully created and ready to be used to + // create instances. READY = 2; } // A unique identifier for the instance configuration. Values // are of the form // `projects//instanceConfigs/[a-z][-a-z0-9]*`. + // + // User instance configuration must start with `custom-`. string name = 1; // The name of this instance configuration as it appears in UIs. string display_name = 2; - // Output only. Whether this instance config is a Google or User Managed - // Configuration. + // Output only. Whether this instance configuration is a Google-managed or + // user-managed configuration. Type config_type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; // The geographic placement of nodes in this instance configuration and their @@ -703,30 +777,33 @@ message InstanceConfig { map labels = 8; // etag is used for optimistic concurrency control as a way - // to help prevent simultaneous updates of a instance config from overwriting - // each other. It is strongly suggested that systems make use of the etag in - // the read-modify-write cycle to perform instance config updates in order to - // avoid race conditions: An etag is returned in the response which contains - // instance configs, and systems are expected to put that etag in the request - // to update instance config to ensure that their change will be applied to - // the same version of the instance config. - // If no etag is provided in the call to update instance config, then the - // existing instance config is overwritten blindly. + // to help prevent simultaneous updates of a instance configuration from + // overwriting each other. It is strongly suggested that systems make use of + // the etag in the read-modify-write cycle to perform instance configuration + // updates in order to avoid race conditions: An etag is returned in the + // response which contains instance configurations, and systems are expected + // to put that etag in the request to update instance configuration to ensure + // that their change is applied to the same version of the instance + // configuration. If no etag is provided in the call to update the instance + // configuration, then the existing instance configuration is overwritten + // blindly. string etag = 9; // Allowed values of the "default_leader" schema option for databases in // instances that use this instance configuration. repeated string leader_options = 4; - // Output only. If true, the instance config is being created or updated. If - // false, there are no ongoing operations for the instance config. + // Output only. If true, the instance configuration is being created or + // updated. If false, there are no ongoing operations for the instance + // configuration. bool reconciling = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The current instance config state. + // Output only. The current instance configuration state. Applicable only for + // `USER_MANAGED` configurations. State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; } -// Autoscaling config for an instance. +// Autoscaling configuration for an instance. message AutoscalingConfig { // The autoscaling limits for the instance. Users can define the minimum and // maximum compute capacity allocated to the instance, and the autoscaler will @@ -808,6 +885,22 @@ message Instance { READY = 2; } + // The edition selected for this instance. Different editions provide + // different capabilities at different price points. + enum Edition { + // Edition not specified. + EDITION_UNSPECIFIED = 0; + + // Standard edition. + STANDARD = 1; + + // Enterprise edition. + ENTERPRISE = 2; + + // Enterprise Plus edition. + ENTERPRISE_PLUS = 3; + } + // Required. A unique identifier for the instance, which cannot be changed // after the instance is created. Values are of the form // `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final @@ -904,6 +997,9 @@ message Instance { // Output only. The time at which the instance was most recently updated. google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The `Edition` of the current instance. + Edition edition = 20 [(google.api.field_behavior) = OPTIONAL]; } // The request for @@ -958,8 +1054,8 @@ message GetInstanceConfigRequest { // The request for // [CreateInstanceConfigRequest][InstanceAdmin.CreateInstanceConfigRequest]. message CreateInstanceConfigRequest { - // Required. The name of the project in which to create the instance config. - // Values are of the form `projects/`. + // Required. The name of the project in which to create the instance + // configuration. Values are of the form `projects/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -967,10 +1063,10 @@ message CreateInstanceConfigRequest { } ]; - // Required. The ID of the instance config to create. Valid identifiers are - // of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + // Required. The ID of the instance configuration to create. Valid identifiers + // are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 // characters in length. The `custom-` prefix is required to avoid name - // conflicts with Google managed configurations. + // conflicts with Google-managed configurations. string instance_config_id = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The InstanceConfig proto of the configuration to create. @@ -988,8 +1084,9 @@ message CreateInstanceConfigRequest { // The request for // [UpdateInstanceConfigRequest][InstanceAdmin.UpdateInstanceConfigRequest]. message UpdateInstanceConfigRequest { - // Required. The user instance config to update, which must always include the - // instance config name. Otherwise, only fields mentioned in + // Required. The user instance configuration to update, which must always + // include the instance configuration name. Otherwise, only fields mentioned + // in // [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] // need be included. To prevent conflicts of concurrent updates, // [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can @@ -1024,12 +1121,12 @@ message DeleteInstanceConfigRequest { ]; // Used for optimistic concurrency control as a way to help prevent - // simultaneous deletes of an instance config from overwriting each + // simultaneous deletes of an instance configuration from overwriting each // other. If not empty, the API - // only deletes the instance config when the etag provided matches the current - // status of the requested instance config. Otherwise, deletes the instance - // config without checking the current status of the requested instance - // config. + // only deletes the instance configuration when the etag provided matches the + // current status of the requested instance configuration. Otherwise, deletes + // the instance configuration without checking the current status of the + // requested instance configuration. string etag = 2; // An option to validate, but not actually execute, a request, @@ -1040,7 +1137,7 @@ message DeleteInstanceConfigRequest { // The request for // [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]. message ListInstanceConfigOperationsRequest { - // Required. The project of the instance config operations. + // Required. The project of the instance configuration operations. // Values are of the form `projects/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, @@ -1089,7 +1186,7 @@ message ListInstanceConfigOperationsRequest { // `(error:*)` - Return operations where: // * The operation's metadata type is // [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - // * The instance config name contains "custom-config". + // * The instance configuration name contains "custom-config". // * The operation started before 2021-03-28T14:50:00Z. // * The operation resulted in an error. string filter = 2; @@ -1109,9 +1206,9 @@ message ListInstanceConfigOperationsRequest { // The response for // [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]. message ListInstanceConfigOperationsResponse { - // The list of matching instance config [long-running + // The list of matching instance configuration [long-running // operations][google.longrunning.Operation]. Each operation's name will be - // prefixed by the instance config's name. The operation's + // prefixed by the name of the instance configuration. The operation's // [metadata][google.longrunning.Operation.metadata] field type // `metadata.type_url` describes the type of the metadata. repeated google.longrunning.Operation operations = 1; @@ -1313,7 +1410,7 @@ message UpdateInstanceMetadata { // Metadata type for the operation returned by // [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]. message CreateInstanceConfigMetadata { - // The target instance config end state. + // The target instance configuration end state. InstanceConfig instance_config = 1; // The progress of the @@ -1328,7 +1425,7 @@ message CreateInstanceConfigMetadata { // Metadata type for the operation returned by // [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]. message UpdateInstanceConfigMetadata { - // The desired instance config after updating. + // The desired instance configuration after updating. InstanceConfig instance_config = 1; // The progress of the @@ -1717,3 +1814,47 @@ message ListInstancePartitionOperationsResponse { // [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. repeated string unreachable_instance_partitions = 3; } + +// The request for +// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]. +message MoveInstanceRequest { + // Required. The instance to move. + // Values are of the form `projects//instances/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/Instance" + } + ]; + + // Required. The target instance configuration where to move the instance. + // Values are of the form `projects//instanceConfigs/`. + string target_config = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/InstanceConfig" + } + ]; +} + +// The response for +// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]. +message MoveInstanceResponse {} + +// Metadata type for the operation returned by +// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]. +message MoveInstanceMetadata { + // The target instance configuration where to move the instance. + // Values are of the form `projects//instanceConfigs/`. + string target_config = 1; + + // The progress of the + // [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] + // operation. + // [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent] + // is reset when cancellation is requested. + OperationProgress progress = 2; + + // The time at which this operation was cancelled. + google.protobuf.Timestamp cancel_time = 3; +} diff --git a/protos/protos.d.ts b/protos/protos.d.ts index f91afd2af..d6fb26a0d 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -13423,6 +13423,20 @@ export namespace google { * @returns Promise */ public listInstancePartitionOperations(request: google.spanner.admin.instance.v1.IListInstancePartitionOperationsRequest): Promise; + + /** + * Calls MoveInstance. + * @param request MoveInstanceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public moveInstance(request: google.spanner.admin.instance.v1.IMoveInstanceRequest, callback: google.spanner.admin.instance.v1.InstanceAdmin.MoveInstanceCallback): void; + + /** + * Calls MoveInstance. + * @param request MoveInstanceRequest message or plain object + * @returns Promise + */ + public moveInstance(request: google.spanner.admin.instance.v1.IMoveInstanceRequest): Promise; } namespace InstanceAdmin { @@ -13566,6 +13580,13 @@ export namespace google { * @param [response] ListInstancePartitionOperationsResponse */ type ListInstancePartitionOperationsCallback = (error: (Error|null), response?: google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse) => void; + + /** + * Callback as used by {@link google.spanner.admin.instance.v1.InstanceAdmin|moveInstance}. + * @param error Error, if any + * @param [response] Operation + */ + type MoveInstanceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } /** Properties of a ReplicaInfo. */ @@ -14227,6 +14248,9 @@ export namespace google { /** Instance updateTime */ updateTime?: (google.protobuf.ITimestamp|null); + + /** Instance edition */ + edition?: (google.spanner.admin.instance.v1.Instance.Edition|keyof typeof google.spanner.admin.instance.v1.Instance.Edition|null); } /** Represents an Instance. */ @@ -14271,6 +14295,9 @@ export namespace google { /** Instance updateTime. */ public updateTime?: (google.protobuf.ITimestamp|null); + /** Instance edition. */ + public edition: (google.spanner.admin.instance.v1.Instance.Edition|keyof typeof google.spanner.admin.instance.v1.Instance.Edition); + /** * Creates a new Instance instance using the specified properties. * @param [properties] Properties to set @@ -14357,6 +14384,14 @@ export namespace google { CREATING = 1, READY = 2 } + + /** Edition enum. */ + enum Edition { + EDITION_UNSPECIFIED = 0, + STANDARD = 1, + ENTERPRISE = 2, + ENTERPRISE_PLUS = 3 + } } /** Properties of a ListInstanceConfigsRequest. */ @@ -17586,6 +17621,309 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a MoveInstanceRequest. */ + interface IMoveInstanceRequest { + + /** MoveInstanceRequest name */ + name?: (string|null); + + /** MoveInstanceRequest targetConfig */ + targetConfig?: (string|null); + } + + /** Represents a MoveInstanceRequest. */ + class MoveInstanceRequest implements IMoveInstanceRequest { + + /** + * Constructs a new MoveInstanceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.instance.v1.IMoveInstanceRequest); + + /** MoveInstanceRequest name. */ + public name: string; + + /** MoveInstanceRequest targetConfig. */ + public targetConfig: string; + + /** + * Creates a new MoveInstanceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns MoveInstanceRequest instance + */ + public static create(properties?: google.spanner.admin.instance.v1.IMoveInstanceRequest): google.spanner.admin.instance.v1.MoveInstanceRequest; + + /** + * Encodes the specified MoveInstanceRequest message. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceRequest.verify|verify} messages. + * @param message MoveInstanceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.instance.v1.IMoveInstanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MoveInstanceRequest message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceRequest.verify|verify} messages. + * @param message MoveInstanceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.instance.v1.IMoveInstanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MoveInstanceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MoveInstanceRequest + * @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.spanner.admin.instance.v1.MoveInstanceRequest; + + /** + * Decodes a MoveInstanceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MoveInstanceRequest + * @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.spanner.admin.instance.v1.MoveInstanceRequest; + + /** + * Verifies a MoveInstanceRequest 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 a MoveInstanceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MoveInstanceRequest + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.instance.v1.MoveInstanceRequest; + + /** + * Creates a plain object from a MoveInstanceRequest message. Also converts values to other types if specified. + * @param message MoveInstanceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.instance.v1.MoveInstanceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MoveInstanceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MoveInstanceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MoveInstanceResponse. */ + interface IMoveInstanceResponse { + } + + /** Represents a MoveInstanceResponse. */ + class MoveInstanceResponse implements IMoveInstanceResponse { + + /** + * Constructs a new MoveInstanceResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.instance.v1.IMoveInstanceResponse); + + /** + * Creates a new MoveInstanceResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns MoveInstanceResponse instance + */ + public static create(properties?: google.spanner.admin.instance.v1.IMoveInstanceResponse): google.spanner.admin.instance.v1.MoveInstanceResponse; + + /** + * Encodes the specified MoveInstanceResponse message. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceResponse.verify|verify} messages. + * @param message MoveInstanceResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.instance.v1.IMoveInstanceResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MoveInstanceResponse message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceResponse.verify|verify} messages. + * @param message MoveInstanceResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.instance.v1.IMoveInstanceResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MoveInstanceResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MoveInstanceResponse + * @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.spanner.admin.instance.v1.MoveInstanceResponse; + + /** + * Decodes a MoveInstanceResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MoveInstanceResponse + * @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.spanner.admin.instance.v1.MoveInstanceResponse; + + /** + * Verifies a MoveInstanceResponse 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 a MoveInstanceResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MoveInstanceResponse + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.instance.v1.MoveInstanceResponse; + + /** + * Creates a plain object from a MoveInstanceResponse message. Also converts values to other types if specified. + * @param message MoveInstanceResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.instance.v1.MoveInstanceResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MoveInstanceResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MoveInstanceResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MoveInstanceMetadata. */ + interface IMoveInstanceMetadata { + + /** MoveInstanceMetadata targetConfig */ + targetConfig?: (string|null); + + /** MoveInstanceMetadata progress */ + progress?: (google.spanner.admin.instance.v1.IOperationProgress|null); + + /** MoveInstanceMetadata cancelTime */ + cancelTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a MoveInstanceMetadata. */ + class MoveInstanceMetadata implements IMoveInstanceMetadata { + + /** + * Constructs a new MoveInstanceMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.instance.v1.IMoveInstanceMetadata); + + /** MoveInstanceMetadata targetConfig. */ + public targetConfig: string; + + /** MoveInstanceMetadata progress. */ + public progress?: (google.spanner.admin.instance.v1.IOperationProgress|null); + + /** MoveInstanceMetadata cancelTime. */ + public cancelTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new MoveInstanceMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns MoveInstanceMetadata instance + */ + public static create(properties?: google.spanner.admin.instance.v1.IMoveInstanceMetadata): google.spanner.admin.instance.v1.MoveInstanceMetadata; + + /** + * Encodes the specified MoveInstanceMetadata message. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceMetadata.verify|verify} messages. + * @param message MoveInstanceMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.instance.v1.IMoveInstanceMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MoveInstanceMetadata message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceMetadata.verify|verify} messages. + * @param message MoveInstanceMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.instance.v1.IMoveInstanceMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MoveInstanceMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MoveInstanceMetadata + * @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.spanner.admin.instance.v1.MoveInstanceMetadata; + + /** + * Decodes a MoveInstanceMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MoveInstanceMetadata + * @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.spanner.admin.instance.v1.MoveInstanceMetadata; + + /** + * Verifies a MoveInstanceMetadata 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 a MoveInstanceMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MoveInstanceMetadata + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.instance.v1.MoveInstanceMetadata; + + /** + * Creates a plain object from a MoveInstanceMetadata message. Also converts values to other types if specified. + * @param message MoveInstanceMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.instance.v1.MoveInstanceMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MoveInstanceMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MoveInstanceMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } } } diff --git a/protos/protos.js b/protos/protos.js index e32b07c36..0d8508efa 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -34225,6 +34225,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.spanner.admin.instance.v1.InstanceAdmin|moveInstance}. + * @memberof google.spanner.admin.instance.v1.InstanceAdmin + * @typedef MoveInstanceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls MoveInstance. + * @function moveInstance + * @memberof google.spanner.admin.instance.v1.InstanceAdmin + * @instance + * @param {google.spanner.admin.instance.v1.IMoveInstanceRequest} request MoveInstanceRequest message or plain object + * @param {google.spanner.admin.instance.v1.InstanceAdmin.MoveInstanceCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(InstanceAdmin.prototype.moveInstance = function moveInstance(request, callback) { + return this.rpcCall(moveInstance, $root.google.spanner.admin.instance.v1.MoveInstanceRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "MoveInstance" }); + + /** + * Calls MoveInstance. + * @function moveInstance + * @memberof google.spanner.admin.instance.v1.InstanceAdmin + * @instance + * @param {google.spanner.admin.instance.v1.IMoveInstanceRequest} request MoveInstanceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return InstanceAdmin; })(); @@ -35933,6 +35966,7 @@ * @property {Array.|null} [endpointUris] Instance endpointUris * @property {google.protobuf.ITimestamp|null} [createTime] Instance createTime * @property {google.protobuf.ITimestamp|null} [updateTime] Instance updateTime + * @property {google.spanner.admin.instance.v1.Instance.Edition|null} [edition] Instance edition */ /** @@ -36040,6 +36074,14 @@ */ Instance.prototype.updateTime = null; + /** + * Instance edition. + * @member {google.spanner.admin.instance.v1.Instance.Edition} edition + * @memberof google.spanner.admin.instance.v1.Instance + * @instance + */ + Instance.prototype.edition = 0; + /** * Creates a new Instance instance using the specified properties. * @function create @@ -36088,6 +36130,8 @@ $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); if (message.autoscalingConfig != null && Object.hasOwnProperty.call(message, "autoscalingConfig")) $root.google.spanner.admin.instance.v1.AutoscalingConfig.encode(message.autoscalingConfig, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 20, wireType 0 =*/160).int32(message.edition); return writer; }; @@ -36187,6 +36231,10 @@ message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } + case 20: { + message.edition = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -36276,6 +36324,16 @@ if (error) return "updateTime." + error; } + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } return null; }; @@ -36350,6 +36408,30 @@ throw TypeError(".google.spanner.admin.instance.v1.Instance.updateTime: object expected"); message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); } + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNSPECIFIED": + case 0: + message.edition = 0; + break; + case "STANDARD": + case 1: + message.edition = 1; + break; + case "ENTERPRISE": + case 2: + message.edition = 2; + break; + case "ENTERPRISE_PLUS": + case 3: + message.edition = 3; + break; + } return message; }; @@ -36380,6 +36462,7 @@ object.createTime = null; object.updateTime = null; object.autoscalingConfig = null; + object.edition = options.enums === String ? "EDITION_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -36410,6 +36493,8 @@ object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); if (message.autoscalingConfig != null && message.hasOwnProperty("autoscalingConfig")) object.autoscalingConfig = $root.google.spanner.admin.instance.v1.AutoscalingConfig.toObject(message.autoscalingConfig, options); + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.spanner.admin.instance.v1.Instance.Edition[message.edition] === undefined ? message.edition : $root.google.spanner.admin.instance.v1.Instance.Edition[message.edition] : message.edition; return object; }; @@ -36455,6 +36540,24 @@ return values; })(); + /** + * Edition enum. + * @name google.spanner.admin.instance.v1.Instance.Edition + * @enum {number} + * @property {number} EDITION_UNSPECIFIED=0 EDITION_UNSPECIFIED value + * @property {number} STANDARD=1 STANDARD value + * @property {number} ENTERPRISE=2 ENTERPRISE value + * @property {number} ENTERPRISE_PLUS=3 ENTERPRISE_PLUS value + */ + Instance.Edition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "STANDARD"] = 1; + values[valuesById[2] = "ENTERPRISE"] = 2; + values[valuesById[3] = "ENTERPRISE_PLUS"] = 3; + return values; + })(); + return Instance; })(); @@ -44400,6 +44503,668 @@ return ListInstancePartitionOperationsResponse; })(); + v1.MoveInstanceRequest = (function() { + + /** + * Properties of a MoveInstanceRequest. + * @memberof google.spanner.admin.instance.v1 + * @interface IMoveInstanceRequest + * @property {string|null} [name] MoveInstanceRequest name + * @property {string|null} [targetConfig] MoveInstanceRequest targetConfig + */ + + /** + * Constructs a new MoveInstanceRequest. + * @memberof google.spanner.admin.instance.v1 + * @classdesc Represents a MoveInstanceRequest. + * @implements IMoveInstanceRequest + * @constructor + * @param {google.spanner.admin.instance.v1.IMoveInstanceRequest=} [properties] Properties to set + */ + function MoveInstanceRequest(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]]; + } + + /** + * MoveInstanceRequest name. + * @member {string} name + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @instance + */ + MoveInstanceRequest.prototype.name = ""; + + /** + * MoveInstanceRequest targetConfig. + * @member {string} targetConfig + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @instance + */ + MoveInstanceRequest.prototype.targetConfig = ""; + + /** + * Creates a new MoveInstanceRequest instance using the specified properties. + * @function create + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @static + * @param {google.spanner.admin.instance.v1.IMoveInstanceRequest=} [properties] Properties to set + * @returns {google.spanner.admin.instance.v1.MoveInstanceRequest} MoveInstanceRequest instance + */ + MoveInstanceRequest.create = function create(properties) { + return new MoveInstanceRequest(properties); + }; + + /** + * Encodes the specified MoveInstanceRequest message. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceRequest.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @static + * @param {google.spanner.admin.instance.v1.IMoveInstanceRequest} message MoveInstanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveInstanceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.targetConfig != null && Object.hasOwnProperty.call(message, "targetConfig")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetConfig); + return writer; + }; + + /** + * Encodes the specified MoveInstanceRequest message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @static + * @param {google.spanner.admin.instance.v1.IMoveInstanceRequest} message MoveInstanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveInstanceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MoveInstanceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.instance.v1.MoveInstanceRequest} MoveInstanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveInstanceRequest.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.spanner.admin.instance.v1.MoveInstanceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.targetConfig = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MoveInstanceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.instance.v1.MoveInstanceRequest} MoveInstanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveInstanceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MoveInstanceRequest message. + * @function verify + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MoveInstanceRequest.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.targetConfig != null && message.hasOwnProperty("targetConfig")) + if (!$util.isString(message.targetConfig)) + return "targetConfig: string expected"; + return null; + }; + + /** + * Creates a MoveInstanceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.instance.v1.MoveInstanceRequest} MoveInstanceRequest + */ + MoveInstanceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.instance.v1.MoveInstanceRequest) + return object; + var message = new $root.google.spanner.admin.instance.v1.MoveInstanceRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.targetConfig != null) + message.targetConfig = String(object.targetConfig); + return message; + }; + + /** + * Creates a plain object from a MoveInstanceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @static + * @param {google.spanner.admin.instance.v1.MoveInstanceRequest} message MoveInstanceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MoveInstanceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.targetConfig = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.targetConfig != null && message.hasOwnProperty("targetConfig")) + object.targetConfig = message.targetConfig; + return object; + }; + + /** + * Converts this MoveInstanceRequest to JSON. + * @function toJSON + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @instance + * @returns {Object.} JSON object + */ + MoveInstanceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MoveInstanceRequest + * @function getTypeUrl + * @memberof google.spanner.admin.instance.v1.MoveInstanceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MoveInstanceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.instance.v1.MoveInstanceRequest"; + }; + + return MoveInstanceRequest; + })(); + + v1.MoveInstanceResponse = (function() { + + /** + * Properties of a MoveInstanceResponse. + * @memberof google.spanner.admin.instance.v1 + * @interface IMoveInstanceResponse + */ + + /** + * Constructs a new MoveInstanceResponse. + * @memberof google.spanner.admin.instance.v1 + * @classdesc Represents a MoveInstanceResponse. + * @implements IMoveInstanceResponse + * @constructor + * @param {google.spanner.admin.instance.v1.IMoveInstanceResponse=} [properties] Properties to set + */ + function MoveInstanceResponse(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]]; + } + + /** + * Creates a new MoveInstanceResponse instance using the specified properties. + * @function create + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @static + * @param {google.spanner.admin.instance.v1.IMoveInstanceResponse=} [properties] Properties to set + * @returns {google.spanner.admin.instance.v1.MoveInstanceResponse} MoveInstanceResponse instance + */ + MoveInstanceResponse.create = function create(properties) { + return new MoveInstanceResponse(properties); + }; + + /** + * Encodes the specified MoveInstanceResponse message. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceResponse.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @static + * @param {google.spanner.admin.instance.v1.IMoveInstanceResponse} message MoveInstanceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveInstanceResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MoveInstanceResponse message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @static + * @param {google.spanner.admin.instance.v1.IMoveInstanceResponse} message MoveInstanceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveInstanceResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MoveInstanceResponse message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.instance.v1.MoveInstanceResponse} MoveInstanceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveInstanceResponse.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.spanner.admin.instance.v1.MoveInstanceResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MoveInstanceResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.instance.v1.MoveInstanceResponse} MoveInstanceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveInstanceResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MoveInstanceResponse message. + * @function verify + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MoveInstanceResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MoveInstanceResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.instance.v1.MoveInstanceResponse} MoveInstanceResponse + */ + MoveInstanceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.instance.v1.MoveInstanceResponse) + return object; + return new $root.google.spanner.admin.instance.v1.MoveInstanceResponse(); + }; + + /** + * Creates a plain object from a MoveInstanceResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @static + * @param {google.spanner.admin.instance.v1.MoveInstanceResponse} message MoveInstanceResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MoveInstanceResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MoveInstanceResponse to JSON. + * @function toJSON + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @instance + * @returns {Object.} JSON object + */ + MoveInstanceResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MoveInstanceResponse + * @function getTypeUrl + * @memberof google.spanner.admin.instance.v1.MoveInstanceResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MoveInstanceResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.instance.v1.MoveInstanceResponse"; + }; + + return MoveInstanceResponse; + })(); + + v1.MoveInstanceMetadata = (function() { + + /** + * Properties of a MoveInstanceMetadata. + * @memberof google.spanner.admin.instance.v1 + * @interface IMoveInstanceMetadata + * @property {string|null} [targetConfig] MoveInstanceMetadata targetConfig + * @property {google.spanner.admin.instance.v1.IOperationProgress|null} [progress] MoveInstanceMetadata progress + * @property {google.protobuf.ITimestamp|null} [cancelTime] MoveInstanceMetadata cancelTime + */ + + /** + * Constructs a new MoveInstanceMetadata. + * @memberof google.spanner.admin.instance.v1 + * @classdesc Represents a MoveInstanceMetadata. + * @implements IMoveInstanceMetadata + * @constructor + * @param {google.spanner.admin.instance.v1.IMoveInstanceMetadata=} [properties] Properties to set + */ + function MoveInstanceMetadata(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]]; + } + + /** + * MoveInstanceMetadata targetConfig. + * @member {string} targetConfig + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @instance + */ + MoveInstanceMetadata.prototype.targetConfig = ""; + + /** + * MoveInstanceMetadata progress. + * @member {google.spanner.admin.instance.v1.IOperationProgress|null|undefined} progress + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @instance + */ + MoveInstanceMetadata.prototype.progress = null; + + /** + * MoveInstanceMetadata cancelTime. + * @member {google.protobuf.ITimestamp|null|undefined} cancelTime + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @instance + */ + MoveInstanceMetadata.prototype.cancelTime = null; + + /** + * Creates a new MoveInstanceMetadata instance using the specified properties. + * @function create + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @static + * @param {google.spanner.admin.instance.v1.IMoveInstanceMetadata=} [properties] Properties to set + * @returns {google.spanner.admin.instance.v1.MoveInstanceMetadata} MoveInstanceMetadata instance + */ + MoveInstanceMetadata.create = function create(properties) { + return new MoveInstanceMetadata(properties); + }; + + /** + * Encodes the specified MoveInstanceMetadata message. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceMetadata.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @static + * @param {google.spanner.admin.instance.v1.IMoveInstanceMetadata} message MoveInstanceMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveInstanceMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.targetConfig != null && Object.hasOwnProperty.call(message, "targetConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.targetConfig); + if (message.progress != null && Object.hasOwnProperty.call(message, "progress")) + $root.google.spanner.admin.instance.v1.OperationProgress.encode(message.progress, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.cancelTime != null && Object.hasOwnProperty.call(message, "cancelTime")) + $root.google.protobuf.Timestamp.encode(message.cancelTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MoveInstanceMetadata message, length delimited. Does not implicitly {@link google.spanner.admin.instance.v1.MoveInstanceMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @static + * @param {google.spanner.admin.instance.v1.IMoveInstanceMetadata} message MoveInstanceMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveInstanceMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MoveInstanceMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.instance.v1.MoveInstanceMetadata} MoveInstanceMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveInstanceMetadata.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.spanner.admin.instance.v1.MoveInstanceMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.targetConfig = reader.string(); + break; + } + case 2: { + message.progress = $root.google.spanner.admin.instance.v1.OperationProgress.decode(reader, reader.uint32()); + break; + } + case 3: { + message.cancelTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MoveInstanceMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.instance.v1.MoveInstanceMetadata} MoveInstanceMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveInstanceMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MoveInstanceMetadata message. + * @function verify + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MoveInstanceMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.targetConfig != null && message.hasOwnProperty("targetConfig")) + if (!$util.isString(message.targetConfig)) + return "targetConfig: string expected"; + if (message.progress != null && message.hasOwnProperty("progress")) { + var error = $root.google.spanner.admin.instance.v1.OperationProgress.verify(message.progress); + if (error) + return "progress." + error; + } + if (message.cancelTime != null && message.hasOwnProperty("cancelTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.cancelTime); + if (error) + return "cancelTime." + error; + } + return null; + }; + + /** + * Creates a MoveInstanceMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.instance.v1.MoveInstanceMetadata} MoveInstanceMetadata + */ + MoveInstanceMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.instance.v1.MoveInstanceMetadata) + return object; + var message = new $root.google.spanner.admin.instance.v1.MoveInstanceMetadata(); + if (object.targetConfig != null) + message.targetConfig = String(object.targetConfig); + if (object.progress != null) { + if (typeof object.progress !== "object") + throw TypeError(".google.spanner.admin.instance.v1.MoveInstanceMetadata.progress: object expected"); + message.progress = $root.google.spanner.admin.instance.v1.OperationProgress.fromObject(object.progress); + } + if (object.cancelTime != null) { + if (typeof object.cancelTime !== "object") + throw TypeError(".google.spanner.admin.instance.v1.MoveInstanceMetadata.cancelTime: object expected"); + message.cancelTime = $root.google.protobuf.Timestamp.fromObject(object.cancelTime); + } + return message; + }; + + /** + * Creates a plain object from a MoveInstanceMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @static + * @param {google.spanner.admin.instance.v1.MoveInstanceMetadata} message MoveInstanceMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MoveInstanceMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.targetConfig = ""; + object.progress = null; + object.cancelTime = null; + } + if (message.targetConfig != null && message.hasOwnProperty("targetConfig")) + object.targetConfig = message.targetConfig; + if (message.progress != null && message.hasOwnProperty("progress")) + object.progress = $root.google.spanner.admin.instance.v1.OperationProgress.toObject(message.progress, options); + if (message.cancelTime != null && message.hasOwnProperty("cancelTime")) + object.cancelTime = $root.google.protobuf.Timestamp.toObject(message.cancelTime, options); + return object; + }; + + /** + * Converts this MoveInstanceMetadata to JSON. + * @function toJSON + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @instance + * @returns {Object.} JSON object + */ + MoveInstanceMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MoveInstanceMetadata + * @function getTypeUrl + * @memberof google.spanner.admin.instance.v1.MoveInstanceMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MoveInstanceMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.instance.v1.MoveInstanceMetadata"; + }; + + return MoveInstanceMetadata; + })(); + return v1; })(); diff --git a/protos/protos.json b/protos/protos.json index f344ee884..3b2ab56bc 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -1740,7 +1740,8 @@ "type": "string", "id": 14, "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "spanner.googleapis.com/BackupSchedule" } }, "incrementalBackupChainId": { @@ -4046,6 +4047,30 @@ "(google.api.method_signature)": "parent" } ] + }, + "MoveInstance": { + "requestType": "MoveInstanceRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/instances/*}:move", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.spanner.admin.instance.v1.MoveInstanceResponse", + "(google.longrunning.operation_info).metadata_type": "google.spanner.admin.instance.v1.MoveInstanceMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/instances/*}:move", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.spanner.admin.instance.v1.MoveInstanceResponse", + "metadata_type": "google.spanner.admin.instance.v1.MoveInstanceMetadata" + } + } + ] } } }, @@ -4307,6 +4332,13 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "edition": { + "type": "Edition", + "id": 20, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } }, "nested": { @@ -4316,6 +4348,14 @@ "CREATING": 1, "READY": 2 } + }, + "Edition": { + "values": { + "EDITION_UNSPECIFIED": 0, + "STANDARD": 1, + "ENTERPRISE": 2, + "ENTERPRISE_PLUS": 3 + } } } }, @@ -4981,6 +5021,45 @@ "id": 3 } } + }, + "MoveInstanceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "spanner.googleapis.com/Instance" + } + }, + "targetConfig": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "spanner.googleapis.com/InstanceConfig" + } + } + } + }, + "MoveInstanceResponse": { + "fields": {} + }, + "MoveInstanceMetadata": { + "fields": { + "targetConfig": { + "type": "string", + "id": 1 + }, + "progress": { + "type": "OperationProgress", + "id": 2 + }, + "cancelTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } } } } diff --git a/src/v1/database_admin_client.ts b/src/v1/database_admin_client.ts index 99cd4637c..4b71eb300 100644 --- a/src/v1/database_admin_client.ts +++ b/src/v1/database_admin_client.ts @@ -3073,6 +3073,7 @@ export class DatabaseAdminClient { * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * * `size_bytes` + * * `backup_schedules` * * You can combine multiple expressions by enclosing each expression in * parentheses. By default, expressions are combined with AND logic, but @@ -3091,6 +3092,8 @@ export class DatabaseAdminClient { * * `expire_time < \"2018-03-28T14:50:00Z\"` * - The backup `expire_time` is before 2018-03-28T14:50:00Z. * * `size_bytes > 10000000000` - The backup's size is greater than 10GB + * * `backup_schedules:daily` + * - The backup is created from a schedule with "daily" in its name. * @param {number} request.pageSize * Number of backups to be returned in the response. If 0 or * less, defaults to the server's maximum allowed page size. @@ -3214,6 +3217,7 @@ export class DatabaseAdminClient { * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * * `size_bytes` + * * `backup_schedules` * * You can combine multiple expressions by enclosing each expression in * parentheses. By default, expressions are combined with AND logic, but @@ -3232,6 +3236,8 @@ export class DatabaseAdminClient { * * `expire_time < \"2018-03-28T14:50:00Z\"` * - The backup `expire_time` is before 2018-03-28T14:50:00Z. * * `size_bytes > 10000000000` - The backup's size is greater than 10GB + * * `backup_schedules:daily` + * - The backup is created from a schedule with "daily" in its name. * @param {number} request.pageSize * Number of backups to be returned in the response. If 0 or * less, defaults to the server's maximum allowed page size. @@ -3303,6 +3309,7 @@ export class DatabaseAdminClient { * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * * `size_bytes` + * * `backup_schedules` * * You can combine multiple expressions by enclosing each expression in * parentheses. By default, expressions are combined with AND logic, but @@ -3321,6 +3328,8 @@ export class DatabaseAdminClient { * * `expire_time < \"2018-03-28T14:50:00Z\"` * - The backup `expire_time` is before 2018-03-28T14:50:00Z. * * `size_bytes > 10000000000` - The backup's size is greater than 10GB + * * `backup_schedules:daily` + * - The backup is created from a schedule with "daily" in its name. * @param {number} request.pageSize * Number of backups to be returned in the response. If 0 or * less, defaults to the server's maximum allowed page size. diff --git a/src/v1/instance_admin_client.ts b/src/v1/instance_admin_client.ts index 9f77a7c55..815a55ad4 100644 --- a/src/v1/instance_admin_client.ts +++ b/src/v1/instance_admin_client.ts @@ -347,6 +347,12 @@ export class InstanceAdminClient { const updateInstancePartitionMetadata = protoFilesRoot.lookup( '.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata' ) as gax.protobuf.Type; + const moveInstanceResponse = protoFilesRoot.lookup( + '.google.spanner.admin.instance.v1.MoveInstanceResponse' + ) as gax.protobuf.Type; + const moveInstanceMetadata = protoFilesRoot.lookup( + '.google.spanner.admin.instance.v1.MoveInstanceMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { createInstanceConfig: new this._gaxModule.LongrunningDescriptor( @@ -387,6 +393,11 @@ export class InstanceAdminClient { updateInstancePartitionMetadata ) ), + moveInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + moveInstanceResponse.decode.bind(moveInstanceResponse), + moveInstanceMetadata.decode.bind(moveInstanceMetadata) + ), }; // Put together the default options sent with requests. @@ -459,6 +470,7 @@ export class InstanceAdminClient { 'deleteInstancePartition', 'updateInstancePartition', 'listInstancePartitionOperations', + 'moveInstance', ]; for (const methodName of instanceAdminStubMethods) { const callPromise = this.instanceAdminStub.then( @@ -675,11 +687,11 @@ export class InstanceAdminClient { return this.innerApiCalls.getInstanceConfig(request, options, callback); } /** - * Deletes the instance config. Deletion is only allowed when no + * Deletes the instance configuration. Deletion is only allowed when no * instances are using the configuration. If any instances are using - * the config, returns `FAILED_PRECONDITION`. + * the configuration, returns `FAILED_PRECONDITION`. * - * Only user managed configurations can be deleted. + * Only user-managed configurations can be deleted. * * Authorization requires `spanner.instanceConfigs.delete` permission on * the resource {@link protos.google.spanner.admin.instance.v1.InstanceConfig.name|name}. @@ -692,12 +704,12 @@ export class InstanceAdminClient { * `projects//instanceConfigs/` * @param {string} request.etag * Used for optimistic concurrency control as a way to help prevent - * simultaneous deletes of an instance config from overwriting each + * simultaneous deletes of an instance configuration from overwriting each * other. If not empty, the API - * only deletes the instance config when the etag provided matches the current - * status of the requested instance config. Otherwise, deletes the instance - * config without checking the current status of the requested instance - * config. + * only deletes the instance configuration when the etag provided matches the + * current status of the requested instance configuration. Otherwise, deletes + * the instance configuration without checking the current status of the + * requested instance configuration. * @param {boolean} request.validateOnly * An option to validate, but not actually execute, a request, * and provide the same response. @@ -1471,38 +1483,38 @@ export class InstanceAdminClient { } /** - * Creates an instance config and begins preparing it to be used. The + * Creates an instance configuration and begins preparing it to be used. The * returned {@link protos.google.longrunning.Operation|long-running operation} * can be used to track the progress of preparing the new - * instance config. The instance config name is assigned by the caller. If the - * named instance config already exists, `CreateInstanceConfig` returns - * `ALREADY_EXISTS`. + * instance configuration. The instance configuration name is assigned by the + * caller. If the named instance configuration already exists, + * `CreateInstanceConfig` returns `ALREADY_EXISTS`. * * Immediately after the request returns: * - * * The instance config is readable via the API, with all requested - * attributes. The instance config's + * * The instance configuration is readable via the API, with all requested + * attributes. The instance configuration's * {@link protos.google.spanner.admin.instance.v1.InstanceConfig.reconciling|reconciling} * field is set to true. Its state is `CREATING`. * * While the operation is pending: * - * * Cancelling the operation renders the instance config immediately + * * Cancelling the operation renders the instance configuration immediately * unreadable via the API. * * Except for deleting the creating resource, all other attempts to modify - * the instance config are rejected. + * the instance configuration are rejected. * * Upon completion of the returned operation: * * * Instances can be created using the instance configuration. - * * The instance config's + * * The instance configuration's * {@link protos.google.spanner.admin.instance.v1.InstanceConfig.reconciling|reconciling} * field becomes false. Its state becomes `READY`. * * The returned {@link protos.google.longrunning.Operation|long-running operation} will * have a name of the format * `/operations/` and can be used to track - * creation of the instance config. The + * creation of the instance configuration. The * {@link protos.google.longrunning.Operation.metadata|metadata} field type is * {@link protos.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata|CreateInstanceConfigMetadata}. * The {@link protos.google.longrunning.Operation.response|response} field type is @@ -1516,13 +1528,13 @@ export class InstanceAdminClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The name of the project in which to create the instance config. - * Values are of the form `projects/`. + * Required. The name of the project in which to create the instance + * configuration. Values are of the form `projects/`. * @param {string} request.instanceConfigId - * Required. The ID of the instance config to create. Valid identifiers are - * of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * Required. The ID of the instance configuration to create. Valid identifiers + * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 * characters in length. The `custom-` prefix is required to avoid name - * conflicts with Google managed configurations. + * conflicts with Google-managed configurations. * @param {google.spanner.admin.instance.v1.InstanceConfig} request.instanceConfig * Required. The InstanceConfig proto of the configuration to create. * instance_config.name must be @@ -1658,16 +1670,16 @@ export class InstanceAdminClient { >; } /** - * Updates an instance config. The returned + * Updates an instance configuration. The returned * {@link protos.google.longrunning.Operation|long-running operation} can be used to track - * the progress of updating the instance. If the named instance config does - * not exist, returns `NOT_FOUND`. + * the progress of updating the instance. If the named instance configuration + * does not exist, returns `NOT_FOUND`. * - * Only user managed configurations can be updated. + * Only user-managed configurations can be updated. * * Immediately after the request returns: * - * * The instance config's + * * The instance configuration's * {@link protos.google.spanner.admin.instance.v1.InstanceConfig.reconciling|reconciling} * field is set to true. * @@ -1677,23 +1689,23 @@ export class InstanceAdminClient { * {@link protos.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time|cancel_time}. * The operation is guaranteed to succeed at undoing all changes, after * which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance config are rejected. - * * Reading the instance config via the API continues to give the + * * All other attempts to modify the instance configuration are rejected. + * * Reading the instance configuration via the API continues to give the * pre-request values. * * Upon completion of the returned operation: * * * Creating instances using the instance configuration uses the new * values. - * * The instance config's new values are readable via the API. - * * The instance config's + * * The new values of the instance configuration are readable via the API. + * * The instance configuration's * {@link protos.google.spanner.admin.instance.v1.InstanceConfig.reconciling|reconciling} * field becomes false. * * The returned {@link protos.google.longrunning.Operation|long-running operation} will * have a name of the format * `/operations/` and can be used to track - * the instance config modification. The + * the instance configuration modification. The * {@link protos.google.longrunning.Operation.metadata|metadata} field type is * {@link protos.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata|UpdateInstanceConfigMetadata}. * The {@link protos.google.longrunning.Operation.response|response} field type is @@ -1706,8 +1718,9 @@ export class InstanceAdminClient { * @param {Object} request * The request object that will be sent. * @param {google.spanner.admin.instance.v1.InstanceConfig} request.instanceConfig - * Required. The user instance config to update, which must always include the - * instance config name. Otherwise, only fields mentioned in + * Required. The user instance configuration to update, which must always + * include the instance configuration name. Otherwise, only fields mentioned + * in * {@link protos.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask|update_mask} * need be included. To prevent conflicts of concurrent updates, * {@link protos.google.spanner.admin.instance.v1.InstanceConfig.reconciling|etag} can @@ -2571,6 +2584,202 @@ export class InstanceAdminClient { protos.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata >; } + /** + * Moves an instance to the target instance configuration. You can use the + * returned {@link protos.google.longrunning.Operation|long-running operation} to track + * the progress of moving the instance. + * + * `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of + * the following criteria: + * + * * Is undergoing a move to a different instance configuration + * * Has backups + * * Has an ongoing update + * * Contains any CMEK-enabled databases + * * Is a free trial instance + * + * While the operation is pending: + * + * * All other attempts to modify the instance, including changes to its + * compute capacity, are rejected. + * * The following database and backup admin operations are rejected: + * + * * `DatabaseAdmin.CreateDatabase` + * * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is + * specified in the request.) + * * `DatabaseAdmin.RestoreDatabase` + * * `DatabaseAdmin.CreateBackup` + * * `DatabaseAdmin.CopyBackup` + * + * * Both the source and target instance configurations are subject to + * hourly compute and storage charges. + * * The instance might experience higher read-write latencies and a higher + * transaction abort rate. However, moving an instance doesn't cause any + * downtime. + * + * The returned {@link protos.google.longrunning.Operation|long-running operation} has + * a name of the format + * `/operations/` and can be used to track + * the move instance operation. The + * {@link protos.google.longrunning.Operation.metadata|metadata} field type is + * {@link protos.google.spanner.admin.instance.v1.MoveInstanceMetadata|MoveInstanceMetadata}. + * The {@link protos.google.longrunning.Operation.response|response} field type is + * {@link protos.google.spanner.admin.instance.v1.Instance|Instance}, + * if successful. + * Cancelling the operation sets its metadata's + * {@link protos.google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time|cancel_time}. + * Cancellation is not immediate because it involves moving any data + * previously moved to the target instance configuration back to the original + * instance configuration. You can use this operation to track the progress of + * the cancellation. Upon successful completion of the cancellation, the + * operation terminates with `CANCELLED` status. + * + * If not cancelled, upon completion of the returned operation: + * + * * The instance successfully moves to the target instance + * configuration. + * * You are billed for compute and storage in target instance + * configuration. + * + * Authorization requires the `spanner.instances.update` permission on + * the resource {@link protos.google.spanner.admin.instance.v1.Instance|instance}. + * + * For more details, see + * [Move an instance](https://cloud.google.com/spanner/docs/move-instance). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The instance to move. + * Values are of the form `projects//instances/`. + * @param {string} request.targetConfig + * Required. The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + */ + moveInstance( + request?: protos.google.spanner.admin.instance.v1.IMoveInstanceRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.spanner.admin.instance.v1.IMoveInstanceResponse, + protos.google.spanner.admin.instance.v1.IMoveInstanceMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + moveInstance( + request: protos.google.spanner.admin.instance.v1.IMoveInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.spanner.admin.instance.v1.IMoveInstanceResponse, + protos.google.spanner.admin.instance.v1.IMoveInstanceMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + moveInstance( + request: protos.google.spanner.admin.instance.v1.IMoveInstanceRequest, + callback: Callback< + LROperation< + protos.google.spanner.admin.instance.v1.IMoveInstanceResponse, + protos.google.spanner.admin.instance.v1.IMoveInstanceMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + moveInstance( + request?: protos.google.spanner.admin.instance.v1.IMoveInstanceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.spanner.admin.instance.v1.IMoveInstanceResponse, + protos.google.spanner.admin.instance.v1.IMoveInstanceMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.spanner.admin.instance.v1.IMoveInstanceResponse, + protos.google.spanner.admin.instance.v1.IMoveInstanceMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.spanner.admin.instance.v1.IMoveInstanceResponse, + protos.google.spanner.admin.instance.v1.IMoveInstanceMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.moveInstance(request, options, callback); + } + /** + * Check the status of the long running operation returned by `moveInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + */ + async checkMoveInstanceProgress( + name: string + ): Promise< + LROperation< + protos.google.spanner.admin.instance.v1.MoveInstanceResponse, + protos.google.spanner.admin.instance.v1.MoveInstanceMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.moveInstance, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.spanner.admin.instance.v1.MoveInstanceResponse, + protos.google.spanner.admin.instance.v1.MoveInstanceMetadata + >; + } /** * Lists the supported instance configurations for a given project. * @@ -2774,9 +2983,9 @@ export class InstanceAdminClient { ) as AsyncIterable; } /** - * Lists the user-managed instance config [long-running + * Lists the user-managed instance configuration [long-running * operations][google.longrunning.Operation] in the given project. An instance - * config operation has a name of the form + * configuration operation has a name of the form * `projects//instanceConfigs//operations/`. * The long-running operation * {@link protos.google.longrunning.Operation.metadata|metadata} field type @@ -2789,7 +2998,7 @@ export class InstanceAdminClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The project of the instance config operations. + * Required. The project of the instance configuration operations. * Values are of the form `projects/`. * @param {string} request.filter * An expression that filters the list of returned operations. @@ -2832,7 +3041,7 @@ export class InstanceAdminClient { * `(error:*)` - Return operations where: * * The operation's metadata type is * {@link protos.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata|CreateInstanceConfigMetadata}. - * * The instance config name contains "custom-config". + * * The instance configuration name contains "custom-config". * * The operation started before 2021-03-28T14:50:00Z. * * The operation resulted in an error. * @param {number} request.pageSize @@ -2940,7 +3149,7 @@ export class InstanceAdminClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The project of the instance config operations. + * Required. The project of the instance configuration operations. * Values are of the form `projects/`. * @param {string} request.filter * An expression that filters the list of returned operations. @@ -2983,7 +3192,7 @@ export class InstanceAdminClient { * `(error:*)` - Return operations where: * * The operation's metadata type is * {@link protos.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata|CreateInstanceConfigMetadata}. - * * The instance config name contains "custom-config". + * * The instance configuration name contains "custom-config". * * The operation started before 2021-03-28T14:50:00Z. * * The operation resulted in an error. * @param {number} request.pageSize @@ -3035,7 +3244,7 @@ export class InstanceAdminClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The project of the instance config operations. + * Required. The project of the instance configuration operations. * Values are of the form `projects/`. * @param {string} request.filter * An expression that filters the list of returned operations. @@ -3078,7 +3287,7 @@ export class InstanceAdminClient { * `(error:*)` - Return operations where: * * The operation's metadata type is * {@link protos.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata|CreateInstanceConfigMetadata}. - * * The instance config name contains "custom-config". + * * The instance configuration name contains "custom-config". * * The operation started before 2021-03-28T14:50:00Z. * * The operation resulted in an error. * @param {number} request.pageSize diff --git a/src/v1/instance_admin_client_config.json b/src/v1/instance_admin_client_config.json index 8e6c06c84..cbe3ae620 100644 --- a/src/v1/instance_admin_client_config.json +++ b/src/v1/instance_admin_client_config.json @@ -118,6 +118,10 @@ "ListInstancePartitionOperations": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" + }, + "MoveInstance": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" } } } diff --git a/test/gapic_instance_admin_v1.ts b/test/gapic_instance_admin_v1.ts index 7c6158072..513c65da8 100644 --- a/test/gapic_instance_admin_v1.ts +++ b/test/gapic_instance_admin_v1.ts @@ -2701,6 +2701,196 @@ describe('v1.InstanceAdminClient', () => { }); }); + describe('moveInstance', () => { + it('invokes moveInstance without error', async () => { + const client = new instanceadminModule.v1.InstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.instance.v1.MoveInstanceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.instance.v1.MoveInstanceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.moveInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.moveInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.moveInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.moveInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveInstance without error using callback', async () => { + const client = new instanceadminModule.v1.InstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.instance.v1.MoveInstanceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.instance.v1.MoveInstanceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.moveInstance = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.moveInstance( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.spanner.admin.instance.v1.IMoveInstanceResponse, + protos.google.spanner.admin.instance.v1.IMoveInstanceMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.spanner.admin.instance.v1.IMoveInstanceResponse, + protos.google.spanner.admin.instance.v1.IMoveInstanceMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.moveInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.moveInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveInstance with call error', async () => { + const client = new instanceadminModule.v1.InstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.instance.v1.MoveInstanceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.instance.v1.MoveInstanceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveInstance = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.moveInstance(request), expectedError); + const actualRequest = ( + client.innerApiCalls.moveInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.moveInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveInstance with LRO error', async () => { + const client = new instanceadminModule.v1.InstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.instance.v1.MoveInstanceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.instance.v1.MoveInstanceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveInstance = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.moveInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.moveInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.moveInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkMoveInstanceProgress without error', async () => { + const client = new instanceadminModule.v1.InstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkMoveInstanceProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkMoveInstanceProgress with error', async () => { + const client = new instanceadminModule.v1.InstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkMoveInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('listInstanceConfigs', () => { it('invokes listInstanceConfigs without error', async () => { const client = new instanceadminModule.v1.InstanceAdminClient({