diff --git a/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto b/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto index d7b2ead1c..108e768fe 100644 --- a/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto +++ b/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto @@ -309,7 +309,6 @@ message CreateInstanceRequest { // cluster ID, e.g., just `mycluster` rather than // `projects/myproject/instances/myinstance/clusters/mycluster`. // Fields marked `OutputOnly` must be left blank. - // Currently, at most four clusters can be specified. map clusters = 4 [(google.api.field_behavior) = REQUIRED]; } diff --git a/protos/google/bigtable/admin/v2/bigtable_table_admin.proto b/protos/google/bigtable/admin/v2/bigtable_table_admin.proto index 88bd87047..2d9b22d14 100644 --- a/protos/google/bigtable/admin/v2/bigtable_table_admin.proto +++ b/protos/google/bigtable/admin/v2/bigtable_table_admin.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -72,7 +72,8 @@ service BigtableTableAdmin { // feature might be changed in backward-incompatible ways and is not // recommended for production use. It is not subject to any SLA or deprecation // policy. - rpc CreateTableFromSnapshot(CreateTableFromSnapshotRequest) returns (google.longrunning.Operation) { + rpc CreateTableFromSnapshot(CreateTableFromSnapshotRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2/{parent=projects/*/instances/*}/tables:createFromSnapshot" body: "*" @@ -108,6 +109,20 @@ service BigtableTableAdmin { option (google.api.method_signature) = "name"; } + // Restores a specified table which was accidentally deleted. + rpc UndeleteTable(UndeleteTableRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/instances/*/tables/*}:undelete" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Table" + metadata_type: "UndeleteTableMetadata" + }; + } + // Performs a series of column family modifications on the specified table. // Either all or none of the modifications will occur before this method // returns, but data requests received prior to that point may see a table @@ -134,7 +149,8 @@ service BigtableTableAdmin { // CheckConsistency to check whether mutations to the table that finished // before this call started have been replicated. The tokens will be available // for 90 days. - rpc GenerateConsistencyToken(GenerateConsistencyTokenRequest) returns (GenerateConsistencyTokenResponse) { + rpc GenerateConsistencyToken(GenerateConsistencyTokenRequest) + returns (GenerateConsistencyTokenResponse) { option (google.api.http) = { post: "/v2/{name=projects/*/instances/*/tables/*}:generateConsistencyToken" body: "*" @@ -145,7 +161,8 @@ service BigtableTableAdmin { // Checks replication consistency based on a consistency token, that is, if // replication has caught up based on the conditions specified in the token // and the check request. - rpc CheckConsistency(CheckConsistencyRequest) returns (CheckConsistencyResponse) { + rpc CheckConsistency(CheckConsistencyRequest) + returns (CheckConsistencyResponse) { option (google.api.http) = { post: "/v2/{name=projects/*/instances/*/tables/*}:checkConsistency" body: "*" @@ -161,12 +178,14 @@ service BigtableTableAdmin { // feature might be changed in backward-incompatible ways and is not // recommended for production use. It is not subject to any SLA or deprecation // policy. - rpc SnapshotTable(SnapshotTableRequest) returns (google.longrunning.Operation) { + rpc SnapshotTable(SnapshotTableRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2/{name=projects/*/instances/*/tables/*}:snapshot" body: "*" }; - option (google.api.method_signature) = "name,cluster,snapshot_id,description"; + option (google.api.method_signature) = + "name,cluster,snapshot_id,description"; option (google.longrunning.operation_info) = { response_type: "Snapshot" metadata_type: "SnapshotTableMetadata" @@ -221,8 +240,8 @@ service BigtableTableAdmin { // [metadata][google.longrunning.Operation.metadata] field type is // [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The // [response][google.longrunning.Operation.response] field type is - // [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the returned operation will stop the - // creation and delete the backup. + // [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the + // returned operation will stop the creation and delete the backup. rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2/{parent=projects/*/instances/*/clusters/*}/backups" @@ -288,10 +307,26 @@ service BigtableTableAdmin { }; } - // Gets the access control policy for a Table or Backup resource. + // Copy a Cloud Bigtable backup to a new backup in the destination cluster + // located in the destination instance and project. + rpc CopyBackup(CopyBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/instances/*/clusters/*}/backups:copy" + body: "*" + }; + option (google.api.method_signature) = + "parent,backup_id,source_backup,expire_time"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "CopyBackupMetadata" + }; + } + + // Gets the access control policy for a Table resource. // Returns an empty policy if the resource exists but does not have a policy // set. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { option (google.api.http) = { post: "/v2/{resource=projects/*/instances/*/tables/*}:getIamPolicy" body: "*" @@ -303,9 +338,10 @@ service BigtableTableAdmin { option (google.api.method_signature) = "resource"; } - // Sets the access control policy on a Table or Backup resource. + // Sets the access control policy on a Table resource. // Replaces any existing policy. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { option (google.api.http) = { post: "/v2/{resource=projects/*/instances/*/tables/*}:setIamPolicy" body: "*" @@ -317,8 +353,9 @@ service BigtableTableAdmin { option (google.api.method_signature) = "resource,policy"; } - // Returns permissions that the caller has on the specified Table or Backup resource. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + // Returns permissions that the caller has on the specified table resource. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { option (google.api.http) = { post: "/v2/{resource=projects/*/instances/*/tables/*}:testIamPermissions" body: "*" @@ -355,8 +392,8 @@ message RestoreTableRequest { // Name of the backup from which to restore. Values are of the form // `projects//instances//clusters//backups/`. string backup = 3 [(google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Backup" - }]; + type: "bigtableadmin.googleapis.com/Backup" + }]; } } @@ -370,7 +407,8 @@ message RestoreTableMetadata { RestoreSourceType source_type = 2; // Information about the source used to restore the table, as specified by - // `source` in [RestoreTableRequest][google.bigtable.admin.v2.RestoreTableRequest]. + // `source` in + // [RestoreTableRequest][google.bigtable.admin.v2.RestoreTableRequest]. oneof source_info { BackupInfo backup_info = 3; } @@ -386,7 +424,8 @@ message RestoreTableMetadata { // not successful. string optimize_table_operation_name = 4; - // The progress of the [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable] + // The progress of the + // [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable] // operation. OperationProgress progress = 5; } @@ -421,8 +460,8 @@ message CreateTableRequest { } ]; - // Required. The name by which the new table should be referred to within the parent - // instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + // Required. The name by which the new table should be referred to within the + // parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`. // Maximum 50 characters. string table_id = 2 [(google.api.field_behavior) = REQUIRED]; @@ -465,13 +504,13 @@ message CreateTableFromSnapshotRequest { } ]; - // Required. The name by which the new table should be referred to within the parent - // instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + // Required. The name by which the new table should be referred to within the + // parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`. string table_id = 2 [(google.api.field_behavior) = REQUIRED]; - // Required. The unique name of the snapshot from which to restore the table. The - // snapshot and the table must be in the same instance. - // Values are of the form + // Required. The unique name of the snapshot from which to restore the table. + // The snapshot and the table must be in the same instance. Values are of the + // form // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. string source_snapshot = 3 [ (google.api.field_behavior) = REQUIRED, @@ -508,8 +547,8 @@ message DropRowRangeRequest { // Request message for // [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables] message ListTablesRequest { - // Required. The unique name of the instance for which tables should be listed. - // Values are of the form `projects/{project}/instances/{instance}`. + // Required. The unique name of the instance for which tables should be + // listed. Values are of the form `projects/{project}/instances/{instance}`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -518,7 +557,8 @@ message ListTablesRequest { ]; // The view to be applied to the returned tables' fields. - // Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. + // Only NAME_ONLY view (default), REPLICATION_VIEW and ENCRYPTION_VIEW are + // supported. Table.View view = 2; // Maximum number of results per page. @@ -580,6 +620,33 @@ message DeleteTableRequest { ]; } +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable] +message UndeleteTableRequest { + // Required. The unique name of the table to be restored. + // Values are of the form + // `projects/{project}/instances/{instance}/tables/{table}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; +} + +// Metadata type for the operation returned by +// [google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable]. +message UndeleteTableMetadata { + // The name of the table being restored. + string name = 1; + + // The time at which this operation started. + google.protobuf.Timestamp start_time = 2; + + // If set, the time at which this operation finished or was cancelled. + google.protobuf.Timestamp end_time = 3; +} + // Request message for // [google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies][google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies] message ModifyColumnFamiliesRequest { @@ -588,7 +655,7 @@ message ModifyColumnFamiliesRequest { // The ID of the column family to be modified. string id = 1; - // Column familiy modifications. + // Column family modifications. oneof mod { // Create a new column family with the specified schema, or fail if // one already exists with the given ID. @@ -614,18 +681,19 @@ message ModifyColumnFamiliesRequest { } ]; - // Required. Modifications to be atomically applied to the specified table's families. - // Entries are applied in order, meaning that earlier modifications can be - // masked by later ones (in the case of repeated updates to the same family, - // for example). - repeated Modification modifications = 2 [(google.api.field_behavior) = REQUIRED]; + // Required. Modifications to be atomically applied to the specified table's + // families. Entries are applied in order, meaning that earlier modifications + // can be masked by later ones (in the case of repeated updates to the same + // family, for example). + repeated Modification modifications = 2 + [(google.api.field_behavior) = REQUIRED]; } // Request message for // [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken] message GenerateConsistencyTokenRequest { - // Required. The unique name of the Table for which to create a consistency token. - // Values are of the form + // Required. The unique name of the Table for which to create a consistency + // token. Values are of the form // `projects/{project}/instances/{instance}/tables/{table}`. string name = 1 [ (google.api.field_behavior) = REQUIRED, @@ -645,8 +713,8 @@ message GenerateConsistencyTokenResponse { // Request message for // [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency] message CheckConsistencyRequest { - // Required. The unique name of the Table for which to check replication consistency. - // Values are of the form + // Required. The unique name of the Table for which to check replication + // consistency. Values are of the form // `projects/{project}/instances/{instance}/tables/{table}`. string name = 1 [ (google.api.field_behavior) = REQUIRED, @@ -695,9 +763,9 @@ message SnapshotTableRequest { } ]; - // Required. The ID by which the new snapshot should be referred to within the parent - // cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` - // rather than + // Required. The ID by which the new snapshot should be referred to within the + // parent cluster, e.g., `mysnapshot` of the form: + // `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather than // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. string snapshot_id = 3 [(google.api.field_behavior) = REQUIRED]; @@ -738,8 +806,8 @@ message GetSnapshotRequest { // feature might be changed in backward-incompatible ways and is not recommended // for production use. It is not subject to any SLA or deprecation policy. message ListSnapshotsRequest { - // Required. The unique name of the cluster for which snapshots should be listed. - // Values are of the form + // Required. The unique name of the cluster for which snapshots should be + // listed. Values are of the form // `projects/{project}/instances/{instance}/clusters/{cluster}`. // Use `{cluster} = '-'` to list snapshots for all clusters in an instance, // e.g., `projects/{project}/instances/{instance}/clusters/-`. @@ -829,7 +897,8 @@ message CreateTableFromSnapshotMetadata { google.protobuf.Timestamp finish_time = 3; } -// The request for [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup]. +// The request for +// [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup]. message CreateBackupRequest { // Required. This must be one of the clusters in the instance in which this // table is located. The backup will be stored in this cluster. Values are @@ -869,7 +938,8 @@ message CreateBackupMetadata { google.protobuf.Timestamp end_time = 4; } -// The request for [UpdateBackup][google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup]. +// The request for +// [UpdateBackup][google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup]. message UpdateBackupRequest { // Required. The backup to update. `backup.name`, and the fields to be updated // as specified by `update_mask` are required. Other fields are ignored. @@ -882,10 +952,12 @@ message UpdateBackupRequest { // resource, not to the request message. The field mask must always be // specified; this prevents any future fields from being erased accidentally // by clients that do not know about them. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; } -// The request for [GetBackup][google.bigtable.admin.v2.BigtableTableAdmin.GetBackup]. +// The request for +// [GetBackup][google.bigtable.admin.v2.BigtableTableAdmin.GetBackup]. message GetBackupRequest { // Required. Name of the backup. // Values are of the form @@ -898,7 +970,8 @@ message GetBackupRequest { ]; } -// The request for [DeleteBackup][google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup]. +// The request for +// [DeleteBackup][google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup]. message DeleteBackupRequest { // Required. Name of the backup to delete. // Values are of the form @@ -911,7 +984,8 @@ message DeleteBackupRequest { ]; } -// The request for [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups]. +// The request for +// [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups]. message ListBackupsRequest { // Required. The cluster to list backups from. Values are of the // form `projects/{project}/instances/{instance}/clusters/{cluster}`. @@ -959,8 +1033,9 @@ message ListBackupsRequest { string filter = 2; // An expression for specifying the sort order of the results of the request. - // The string value should specify one or more fields in [Backup][google.bigtable.admin.v2.Backup]. The full - // syntax is described at https://aip.dev/132#ordering. + // The string value should specify one or more fields in + // [Backup][google.bigtable.admin.v2.Backup]. The full syntax is described at + // https://aip.dev/132#ordering. // // Fields supported are: // * name @@ -985,19 +1060,88 @@ message ListBackupsRequest { int32 page_size = 4; // If non-empty, `page_token` should contain a - // [next_page_token][google.bigtable.admin.v2.ListBackupsResponse.next_page_token] from a - // previous [ListBackupsResponse][google.bigtable.admin.v2.ListBackupsResponse] to the same `parent` and with the same - // `filter`. + // [next_page_token][google.bigtable.admin.v2.ListBackupsResponse.next_page_token] + // from a previous + // [ListBackupsResponse][google.bigtable.admin.v2.ListBackupsResponse] to the + // same `parent` and with the same `filter`. string page_token = 5; } -// The response for [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups]. +// The response for +// [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups]. message ListBackupsResponse { // The list of matching backups. repeated Backup backups = 1; // `next_page_token` can be sent in a subsequent - // [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups] call to fetch more - // of the matching backups. + // [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups] call + // to fetch more of the matching backups. string next_page_token = 2; } + +// The request for +// [CopyBackup][google.bigtable.admin.v2.BigtableTableAdmin.CopyBackup]. +message CopyBackupRequest { + // Required. The name of the destination cluster that will contain the backup + // copy. The cluster must already exist. Values are of the form: + // `projects/{project}/instances/{instance}/clusters/{cluster}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; + + // Required. The id of the new backup. The `backup_id` along with `parent` + // are combined as `{parent}/backups/{backup_id}` to create the full backup + // name, of the form: + // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. + // This string must be between 1 and 50 characters in length and match the + // regex `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. + string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The source backup to be copied from. + // The source backup needs to be in READY state for it to be copied. + // Copying a copied backup is not allowed. + // Once CopyBackup is in progress, the source backup cannot be deleted or + // cleaned up on expiration until CopyBackup is finished. + // Values are of the form: + // `projects//instances//clusters//backups/`. + string source_backup = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Backup" + } + ]; + + // Required. Required. The expiration time of the copied backup with + // microsecond granularity that must be at least 6 hours and at most 30 days + // from the time the request is received. Once the `expire_time` has + // passed, Cloud Bigtable will delete the backup and free the resources used + // by the backup. + google.protobuf.Timestamp expire_time = 4 + [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata type for the google.longrunning.Operation returned by +// [CopyBackup][google.bigtable.admin.v2.BigtableTableAdmin.CopyBackup]. +message CopyBackupMetadata { + // The name of the backup being created through the copy operation. + // Values are of the form + // `projects//instances//clusters//backups/`. + string name = 1 [(google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Backup" + }]; + + // The name of the source backup that is being copied from. + // Values are of the form + // `projects//instances//clusters//backups/`. + string source_backup = 2 [(google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Backup" + }]; + + // The progress of the + // [CopyBackup][google.bigtable.admin.v2.BigtableTableAdmin.CopyBackup] + // operation. + OperationProgress progress = 3; +} diff --git a/protos/google/bigtable/admin/v2/instance.proto b/protos/google/bigtable/admin/v2/instance.proto index bbbc5bfaa..cb4710181 100644 --- a/protos/google/bigtable/admin/v2/instance.proto +++ b/protos/google/bigtable/admin/v2/instance.proto @@ -82,17 +82,16 @@ message Instance { // to avoid confusion. string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - // (`OutputOnly`) - // The current state of the instance. - State state = 3; + // Output only. The current state of the instance. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - // The type of the instance. Defaults to `PRODUCTION`. - Type type = 4; + // Required. The type of the instance. Defaults to `PRODUCTION`. + Type type = 4 [(google.api.field_behavior) = REQUIRED]; - // Labels are a flexible and lightweight mechanism for organizing cloud - // resources into groups that reflect a customer's organizational needs and - // deployment strategies. They can be used to filter resources and aggregate - // metrics. + // Required. Labels are a flexible and lightweight mechanism for organizing + // cloud resources into groups that reflect a customer's organizational needs + // and deployment strategies. They can be used to filter resources and + // aggregate metrics. // // * Label keys must be between 1 and 63 characters long and must conform to // the regular expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`. @@ -100,12 +99,16 @@ message Instance { // the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. // * No more than 64 labels can be associated with a given resource. // * Keys and values must both be under 128 bytes. - map labels = 5; + map labels = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. A server-assigned timestamp representing when this Instance + // was created. For instances created before this field was added (August + // 2021), this value is `seconds: 0, nanos: 1`. + google.protobuf.Timestamp create_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. A server-assigned timestamp representing when this Instance was created. - // For instances created before this field was added (August 2021), this value - // is `seconds: 0, nanos: 1`. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. Reserved for future use. + optional bool satisfies_pzs = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; } // The Autoscaling targets for a Cluster. These determine the recommended nodes. @@ -115,6 +118,14 @@ message AutoscalingTargets { // 100 (total utilization), and is limited between 10 and 80, otherwise it // will return INVALID_ARGUMENT error. int32 cpu_utilization_percent = 2; + + // The storage utilization that the Autoscaler should be trying to achieve. + // This number is limited between 2560 (2.5TiB) and 5120 (5TiB) for a SSD + // cluster and between 8192 (8TiB) and 16384 (16TiB) for an HDD cluster, + // otherwise it will return INVALID_ARGUMENT error. If this value is set to 0, + // it will be treated as if it were set to the default value: 2560 for SSD, + // 8192 for HDD. + int32 storage_utilization_gib_per_node = 3; } // Limits for the number of nodes a Cluster can autoscale up/down to. @@ -163,10 +174,12 @@ message Cluster { // Autoscaling config for a cluster. message ClusterAutoscalingConfig { // Required. Autoscaling limits for this cluster. - AutoscalingLimits autoscaling_limits = 1 [(google.api.field_behavior) = REQUIRED]; + AutoscalingLimits autoscaling_limits = 1 + [(google.api.field_behavior) = REQUIRED]; // Required. Autoscaling targets for this cluster. - AutoscalingTargets autoscaling_targets = 2 [(google.api.field_behavior) = REQUIRED]; + AutoscalingTargets autoscaling_targets = 2 + [(google.api.field_behavior) = REQUIRED]; } // Configuration for a cluster. @@ -185,20 +198,19 @@ message Cluster { // `cloudkms.cryptoKeyEncrypterDecrypter` role on the CMEK key. // 2) Only regional keys can be used and the region of the CMEK key must // match the region of the cluster. - // 3) All clusters within an instance must use the same CMEK key. // Values are of the form // `projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}` string kms_key_name = 1 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; + type: "cloudkms.googleapis.com/CryptoKey" + }]; } // The unique name of the cluster. Values are of the form // `projects/{project}/instances/{instance}/clusters/[a-z][-a-z0-9]*`. string name = 1; - // Immutable. The location where this cluster's nodes and storage reside. For best - // performance, clients should be located as close as possible to this + // Immutable. The location where this cluster's nodes and storage reside. For + // best performance, clients should be located as close as possible to this // cluster. Currently only zones are supported, so values should be of the // form `projects/{project}/locations/{zone}`. string location = 2 [ @@ -222,10 +234,12 @@ message Cluster { // Immutable. The type of storage used by this cluster to serve its // parent instance's tables, unless explicitly overridden. - StorageType default_storage_type = 5 [(google.api.field_behavior) = IMMUTABLE]; + StorageType default_storage_type = 5 + [(google.api.field_behavior) = IMMUTABLE]; // Immutable. The encryption configuration for CMEK-protected clusters. - EncryptionConfig encryption_config = 6 [(google.api.field_behavior) = IMMUTABLE]; + EncryptionConfig encryption_config = 6 + [(google.api.field_behavior) = IMMUTABLE]; } // A configuration object describing how Cloud Bigtable should treat traffic @@ -306,14 +320,16 @@ message HotTablet { // Name of the table that contains the tablet. Values are of the form // `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. string table_name = 2 [(google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - }]; + type: "bigtableadmin.googleapis.com/Table" + }]; // Output only. The start time of the hot tablet. - google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp start_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The end time of the hot tablet. - google.protobuf.Timestamp end_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp end_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Tablet Start Key (inclusive). string start_key = 5; @@ -321,9 +337,9 @@ message HotTablet { // Tablet End Key (inclusive). string end_key = 6; - // Output only. The average CPU usage spent by a node on this tablet over the start_time to - // end_time time range. The percentage is the amount of CPU used by the node - // to serve the tablet, from 0% (tablet was not interacted with) to 100% (the - // node spent all cycles serving the hot tablet). + // Output only. The average CPU usage spent by a node on this tablet over the + // start_time to end_time time range. The percentage is the amount of CPU used + // by the node to serve the tablet, from 0% (tablet was not interacted with) + // to 100% (the node spent all cycles serving the hot tablet). float node_cpu_usage_percent = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/protos/google/bigtable/admin/v2/table.proto b/protos/google/bigtable/admin/v2/table.proto index 4e5d2a4a7..3f189739a 100644 --- a/protos/google/bigtable/admin/v2/table.proto +++ b/protos/google/bigtable/admin/v2/table.proto @@ -34,7 +34,6 @@ option (google.api.resource_definition) = { pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}" }; - // Information about a table restore. message RestoreInfo { // The type of the restore source. @@ -88,14 +87,16 @@ message Table { } // Output only. The state of replication for the table in this cluster. - ReplicationState replication_state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + ReplicationState replication_state = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The encryption information for the table in this cluster. // If the encryption key protecting this resource is customer managed, then // its version can be rotated in Cloud Key Management Service (Cloud KMS). // The primary version of the key and its status will be reflected here when // changes propagate from Cloud KMS. - repeated EncryptionInfo encryption_info = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + repeated EncryptionInfo encryption_info = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // Possible timestamp granularities to use when keeping multiple versions @@ -141,20 +142,22 @@ message Table { // particular cluster (for example, if its zone is unavailable), then // there will be an entry for the cluster with UNKNOWN `replication_status`. // Views: `REPLICATION_VIEW`, `ENCRYPTION_VIEW`, `FULL` - map cluster_states = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + map cluster_states = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The column families configured for this table, mapped by column family ID. // Views: `SCHEMA_VIEW`, `FULL` map column_families = 3; - // Immutable. The granularity (i.e. `MILLIS`) at which timestamps are stored in this - // table. Timestamps not matching the granularity will be rejected. - // If unspecified at creation time, the value will be set to `MILLIS`. - // Views: `SCHEMA_VIEW`, `FULL`. - TimestampGranularity granularity = 4 [(google.api.field_behavior) = IMMUTABLE]; + // Immutable. The granularity (i.e. `MILLIS`) at which timestamps are stored + // in this table. Timestamps not matching the granularity will be rejected. If + // unspecified at creation time, the value will be set to `MILLIS`. Views: + // `SCHEMA_VIEW`, `FULL`. + TimestampGranularity granularity = 4 + [(google.api.field_behavior) = IMMUTABLE]; - // Output only. If this table was restored from another data source (e.g. a backup), this - // field will be populated with information about the restore. + // Output only. If this table was restored from another data source (e.g. a + // backup), this field will be populated with information about the restore. RestoreInfo restore_info = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; } @@ -227,14 +230,17 @@ message EncryptionInfo { } // Output only. The type of encryption used to protect this resource. - EncryptionType encryption_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + EncryptionType encryption_type = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The status of encrypt/decrypt calls on underlying data for this resource. - // Regardless of status, the existing data is always encrypted at rest. - google.rpc.Status encryption_status = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The status of encrypt/decrypt calls on underlying data for + // this resource. Regardless of status, the existing data is always encrypted + // at rest. + google.rpc.Status encryption_status = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The version of the Cloud KMS key specified in the parent cluster that is - // in use for the data underlying this table. + // Output only. The version of the Cloud KMS key specified in the parent + // cluster that is in use for the data underlying this table. string kms_key_version = 2 [ (google.api.field_behavior) = OUTPUT_ONLY, (google.api.resource_reference) = { @@ -270,32 +276,33 @@ message Snapshot { CREATING = 2; } - // Output only. The unique name of the snapshot. + // The unique name of the snapshot. // Values are of the form // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. string name = 1; // Output only. The source table at the time the snapshot was taken. - Table source_table = 2; + Table source_table = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The size of the data in the source table at the time the // snapshot was taken. In some cases, this value may be computed // asynchronously via a background process and a placeholder of 0 will be used // in the meantime. - int64 data_size_bytes = 3; + int64 data_size_bytes = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The time when the snapshot is created. - google.protobuf.Timestamp create_time = 4; + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The time when the snapshot will be deleted. The maximum amount - // of time a snapshot can stay active is 365 days. If 'ttl' is not specified, + // The time when the snapshot will be deleted. The maximum amount of time a + // snapshot can stay active is 365 days. If 'ttl' is not specified, // the default maximum of 365 days will be used. google.protobuf.Timestamp delete_time = 5; // Output only. The current state of the snapshot. - State state = 6; + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. Description of the snapshot. + // Description of the snapshot. string description = 7; } @@ -331,8 +338,8 @@ message Backup { // `projects/{project}/instances/{instance}/clusters/{cluster}`. string name = 1; - // Required. Immutable. Name of the table from which this backup was created. This needs - // to be in the same instance as the backup. Values are of the form + // Required. Immutable. Name of the table from which this backup was created. + // This needs to be in the same instance as the backup. Values are of the form // `projects/{project}/instances/{instance}/tables/{source_table}`. string source_table = 2 [ (google.api.field_behavior) = IMMUTABLE, @@ -344,17 +351,21 @@ message Backup { // from the time the request is received. Once the `expire_time` // has passed, Cloud Bigtable will delete the backup and free the // resources used by the backup. - google.protobuf.Timestamp expire_time = 3 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.Timestamp expire_time = 3 + [(google.api.field_behavior) = REQUIRED]; // Output only. `start_time` is the time that the backup was started // (i.e. approximately the time the - // [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup] request is received). The - // row data in this backup will be no older than this timestamp. - google.protobuf.Timestamp start_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + // [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup] + // request is received). The row data in this backup will be no older than + // this timestamp. + google.protobuf.Timestamp start_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. `end_time` is the time that the backup was finished. The row // data in the backup will be no newer than this timestamp. - google.protobuf.Timestamp end_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp end_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Size of the backup in bytes. int64 size_bytes = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; @@ -363,7 +374,8 @@ message Backup { State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The encryption information for the backup. - EncryptionInfo encryption_info = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + EncryptionInfo encryption_info = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // Information about a backup. @@ -373,11 +385,13 @@ message BackupInfo { // Output only. The time that the backup was started. Row data in the backup // will be no older than this timestamp. - google.protobuf.Timestamp start_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp start_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. This time that the backup was finished. Row data in the // backup will be no newer than this timestamp. - google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Name of the table the backup was created from. string source_table = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; diff --git a/protos/protos.d.ts b/protos/protos.d.ts index a7cf2682d..e51141de9 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -344,147 +344,147 @@ export namespace google { namespace BigtableInstanceAdmin { /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#createInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|createInstance}. * @param error Error, if any * @param [response] Operation */ type CreateInstanceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#getInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|getInstance}. * @param error Error, if any * @param [response] Instance */ type GetInstanceCallback = (error: (Error|null), response?: google.bigtable.admin.v2.Instance) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listInstances}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|listInstances}. * @param error Error, if any * @param [response] ListInstancesResponse */ type ListInstancesCallback = (error: (Error|null), response?: google.bigtable.admin.v2.ListInstancesResponse) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#updateInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|updateInstance}. * @param error Error, if any * @param [response] Instance */ type UpdateInstanceCallback = (error: (Error|null), response?: google.bigtable.admin.v2.Instance) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#partialUpdateInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|partialUpdateInstance}. * @param error Error, if any * @param [response] Operation */ type PartialUpdateInstanceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#deleteInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|deleteInstance}. * @param error Error, if any * @param [response] Empty */ type DeleteInstanceCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#createCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|createCluster}. * @param error Error, if any * @param [response] Operation */ type CreateClusterCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#getCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|getCluster}. * @param error Error, if any * @param [response] Cluster */ type GetClusterCallback = (error: (Error|null), response?: google.bigtable.admin.v2.Cluster) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listClusters}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|listClusters}. * @param error Error, if any * @param [response] ListClustersResponse */ type ListClustersCallback = (error: (Error|null), response?: google.bigtable.admin.v2.ListClustersResponse) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#updateCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|updateCluster}. * @param error Error, if any * @param [response] Operation */ type UpdateClusterCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#partialUpdateCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|partialUpdateCluster}. * @param error Error, if any * @param [response] Operation */ type PartialUpdateClusterCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#deleteCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|deleteCluster}. * @param error Error, if any * @param [response] Empty */ type DeleteClusterCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#createAppProfile}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|createAppProfile}. * @param error Error, if any * @param [response] AppProfile */ type CreateAppProfileCallback = (error: (Error|null), response?: google.bigtable.admin.v2.AppProfile) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#getAppProfile}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|getAppProfile}. * @param error Error, if any * @param [response] AppProfile */ type GetAppProfileCallback = (error: (Error|null), response?: google.bigtable.admin.v2.AppProfile) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listAppProfiles}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|listAppProfiles}. * @param error Error, if any * @param [response] ListAppProfilesResponse */ type ListAppProfilesCallback = (error: (Error|null), response?: google.bigtable.admin.v2.ListAppProfilesResponse) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#updateAppProfile}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|updateAppProfile}. * @param error Error, if any * @param [response] Operation */ type UpdateAppProfileCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#deleteAppProfile}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|deleteAppProfile}. * @param error Error, if any * @param [response] Empty */ type DeleteAppProfileCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#getIamPolicy}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|getIamPolicy}. * @param error Error, if any * @param [response] Policy */ type GetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#setIamPolicy}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|setIamPolicy}. * @param error Error, if any * @param [response] Policy */ type SetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#testIamPermissions}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|testIamPermissions}. * @param error Error, if any * @param [response] TestIamPermissionsResponse */ type TestIamPermissionsCallback = (error: (Error|null), response?: google.iam.v1.TestIamPermissionsResponse) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listHotTablets}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|listHotTablets}. * @param error Error, if any * @param [response] ListHotTabletsResponse */ @@ -3196,6 +3196,9 @@ export namespace google { /** Instance createTime */ createTime?: (google.protobuf.ITimestamp|null); + + /** Instance satisfiesPzs */ + satisfiesPzs?: (boolean|null); } /** Represents an Instance. */ @@ -3225,6 +3228,12 @@ export namespace google { /** Instance createTime. */ public createTime?: (google.protobuf.ITimestamp|null); + /** Instance satisfiesPzs. */ + public satisfiesPzs?: (boolean|null); + + /** Instance _satisfiesPzs. */ + public _satisfiesPzs?: "satisfiesPzs"; + /** * Creates a new Instance instance using the specified properties. * @param [properties] Properties to set @@ -3318,6 +3327,9 @@ export namespace google { /** AutoscalingTargets cpuUtilizationPercent */ cpuUtilizationPercent?: (number|null); + + /** AutoscalingTargets storageUtilizationGibPerNode */ + storageUtilizationGibPerNode?: (number|null); } /** Represents an AutoscalingTargets. */ @@ -3332,6 +3344,9 @@ export namespace google { /** AutoscalingTargets cpuUtilizationPercent. */ public cpuUtilizationPercent: number; + /** AutoscalingTargets storageUtilizationGibPerNode. */ + public storageUtilizationGibPerNode: number; + /** * Creates a new AutoscalingTargets instance using the specified properties. * @param [properties] Properties to set @@ -4547,6 +4562,20 @@ export namespace google { */ public deleteTable(request: google.bigtable.admin.v2.IDeleteTableRequest): Promise; + /** + * Calls UndeleteTable. + * @param request UndeleteTableRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public undeleteTable(request: google.bigtable.admin.v2.IUndeleteTableRequest, callback: google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTableCallback): void; + + /** + * Calls UndeleteTable. + * @param request UndeleteTableRequest message or plain object + * @returns Promise + */ + public undeleteTable(request: google.bigtable.admin.v2.IUndeleteTableRequest): Promise; + /** * Calls ModifyColumnFamilies. * @param request ModifyColumnFamiliesRequest message or plain object @@ -4743,6 +4772,20 @@ export namespace google { */ public restoreTable(request: google.bigtable.admin.v2.IRestoreTableRequest): Promise; + /** + * Calls CopyBackup. + * @param request CopyBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public copyBackup(request: google.bigtable.admin.v2.ICopyBackupRequest, callback: google.bigtable.admin.v2.BigtableTableAdmin.CopyBackupCallback): void; + + /** + * Calls CopyBackup. + * @param request CopyBackupRequest message or plain object + * @returns Promise + */ + public copyBackup(request: google.bigtable.admin.v2.ICopyBackupRequest): Promise; + /** * Calls GetIamPolicy. * @param request GetIamPolicyRequest message or plain object @@ -4789,154 +4832,168 @@ export namespace google { namespace BigtableTableAdmin { /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#createTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|createTable}. * @param error Error, if any * @param [response] Table */ type CreateTableCallback = (error: (Error|null), response?: google.bigtable.admin.v2.Table) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#createTableFromSnapshot}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|createTableFromSnapshot}. * @param error Error, if any * @param [response] Operation */ type CreateTableFromSnapshotCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#listTables}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|listTables}. * @param error Error, if any * @param [response] ListTablesResponse */ type ListTablesCallback = (error: (Error|null), response?: google.bigtable.admin.v2.ListTablesResponse) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#getTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|getTable}. * @param error Error, if any * @param [response] Table */ type GetTableCallback = (error: (Error|null), response?: google.bigtable.admin.v2.Table) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#deleteTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|deleteTable}. * @param error Error, if any * @param [response] Empty */ type DeleteTableCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#modifyColumnFamilies}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|undeleteTable}. + * @param error Error, if any + * @param [response] Operation + */ + type UndeleteTableCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|modifyColumnFamilies}. * @param error Error, if any * @param [response] Table */ type ModifyColumnFamiliesCallback = (error: (Error|null), response?: google.bigtable.admin.v2.Table) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#dropRowRange}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|dropRowRange}. * @param error Error, if any * @param [response] Empty */ type DropRowRangeCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#generateConsistencyToken}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|generateConsistencyToken}. * @param error Error, if any * @param [response] GenerateConsistencyTokenResponse */ type GenerateConsistencyTokenCallback = (error: (Error|null), response?: google.bigtable.admin.v2.GenerateConsistencyTokenResponse) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#checkConsistency}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|checkConsistency}. * @param error Error, if any * @param [response] CheckConsistencyResponse */ type CheckConsistencyCallback = (error: (Error|null), response?: google.bigtable.admin.v2.CheckConsistencyResponse) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#snapshotTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|snapshotTable}. * @param error Error, if any * @param [response] Operation */ type SnapshotTableCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#getSnapshot}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|getSnapshot}. * @param error Error, if any * @param [response] Snapshot */ type GetSnapshotCallback = (error: (Error|null), response?: google.bigtable.admin.v2.Snapshot) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#listSnapshots}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|listSnapshots}. * @param error Error, if any * @param [response] ListSnapshotsResponse */ type ListSnapshotsCallback = (error: (Error|null), response?: google.bigtable.admin.v2.ListSnapshotsResponse) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#deleteSnapshot}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|deleteSnapshot}. * @param error Error, if any * @param [response] Empty */ type DeleteSnapshotCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#createBackup}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|createBackup}. * @param error Error, if any * @param [response] Operation */ type CreateBackupCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#getBackup}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|getBackup}. * @param error Error, if any * @param [response] Backup */ type GetBackupCallback = (error: (Error|null), response?: google.bigtable.admin.v2.Backup) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#updateBackup}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|updateBackup}. * @param error Error, if any * @param [response] Backup */ type UpdateBackupCallback = (error: (Error|null), response?: google.bigtable.admin.v2.Backup) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#deleteBackup}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|deleteBackup}. * @param error Error, if any * @param [response] Empty */ type DeleteBackupCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#listBackups}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|listBackups}. * @param error Error, if any * @param [response] ListBackupsResponse */ type ListBackupsCallback = (error: (Error|null), response?: google.bigtable.admin.v2.ListBackupsResponse) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#restoreTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|restoreTable}. * @param error Error, if any * @param [response] Operation */ type RestoreTableCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#getIamPolicy}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|copyBackup}. + * @param error Error, if any + * @param [response] Operation + */ + type CopyBackupCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|getIamPolicy}. * @param error Error, if any * @param [response] Policy */ type GetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#setIamPolicy}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|setIamPolicy}. * @param error Error, if any * @param [response] Policy */ type SetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#testIamPermissions}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|testIamPermissions}. * @param error Error, if any * @param [response] TestIamPermissionsResponse */ @@ -6059,6 +6116,198 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an UndeleteTableRequest. */ + interface IUndeleteTableRequest { + + /** UndeleteTableRequest name */ + name?: (string|null); + } + + /** Represents an UndeleteTableRequest. */ + class UndeleteTableRequest implements IUndeleteTableRequest { + + /** + * Constructs a new UndeleteTableRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.IUndeleteTableRequest); + + /** UndeleteTableRequest name. */ + public name: string; + + /** + * Creates a new UndeleteTableRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeleteTableRequest instance + */ + public static create(properties?: google.bigtable.admin.v2.IUndeleteTableRequest): google.bigtable.admin.v2.UndeleteTableRequest; + + /** + * Encodes the specified UndeleteTableRequest message. Does not implicitly {@link google.bigtable.admin.v2.UndeleteTableRequest.verify|verify} messages. + * @param message UndeleteTableRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.IUndeleteTableRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeleteTableRequest message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.UndeleteTableRequest.verify|verify} messages. + * @param message UndeleteTableRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.IUndeleteTableRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeleteTableRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeleteTableRequest + * @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.bigtable.admin.v2.UndeleteTableRequest; + + /** + * Decodes an UndeleteTableRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeleteTableRequest + * @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.bigtable.admin.v2.UndeleteTableRequest; + + /** + * Verifies an UndeleteTableRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UndeleteTableRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeleteTableRequest + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.UndeleteTableRequest; + + /** + * Creates a plain object from an UndeleteTableRequest message. Also converts values to other types if specified. + * @param message UndeleteTableRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.UndeleteTableRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeleteTableRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UndeleteTableMetadata. */ + interface IUndeleteTableMetadata { + + /** UndeleteTableMetadata name */ + name?: (string|null); + + /** UndeleteTableMetadata startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** UndeleteTableMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an UndeleteTableMetadata. */ + class UndeleteTableMetadata implements IUndeleteTableMetadata { + + /** + * Constructs a new UndeleteTableMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.IUndeleteTableMetadata); + + /** UndeleteTableMetadata name. */ + public name: string; + + /** UndeleteTableMetadata startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** UndeleteTableMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new UndeleteTableMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeleteTableMetadata instance + */ + public static create(properties?: google.bigtable.admin.v2.IUndeleteTableMetadata): google.bigtable.admin.v2.UndeleteTableMetadata; + + /** + * Encodes the specified UndeleteTableMetadata message. Does not implicitly {@link google.bigtable.admin.v2.UndeleteTableMetadata.verify|verify} messages. + * @param message UndeleteTableMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.IUndeleteTableMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeleteTableMetadata message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.UndeleteTableMetadata.verify|verify} messages. + * @param message UndeleteTableMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.IUndeleteTableMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeleteTableMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeleteTableMetadata + * @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.bigtable.admin.v2.UndeleteTableMetadata; + + /** + * Decodes an UndeleteTableMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeleteTableMetadata + * @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.bigtable.admin.v2.UndeleteTableMetadata; + + /** + * Verifies an UndeleteTableMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UndeleteTableMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeleteTableMetadata + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.UndeleteTableMetadata; + + /** + * Creates a plain object from an UndeleteTableMetadata message. Also converts values to other types if specified. + * @param message UndeleteTableMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.UndeleteTableMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeleteTableMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a ModifyColumnFamiliesRequest. */ interface IModifyColumnFamiliesRequest { @@ -8027,207 +8276,417 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a RestoreInfo. */ - interface IRestoreInfo { + /** Properties of a CopyBackupRequest. */ + interface ICopyBackupRequest { - /** RestoreInfo sourceType */ - sourceType?: (google.bigtable.admin.v2.RestoreSourceType|keyof typeof google.bigtable.admin.v2.RestoreSourceType|null); + /** CopyBackupRequest parent */ + parent?: (string|null); - /** RestoreInfo backupInfo */ - backupInfo?: (google.bigtable.admin.v2.IBackupInfo|null); + /** CopyBackupRequest backupId */ + backupId?: (string|null); + + /** CopyBackupRequest sourceBackup */ + sourceBackup?: (string|null); + + /** CopyBackupRequest expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); } - /** Represents a RestoreInfo. */ - class RestoreInfo implements IRestoreInfo { + /** Represents a CopyBackupRequest. */ + class CopyBackupRequest implements ICopyBackupRequest { /** - * Constructs a new RestoreInfo. + * Constructs a new CopyBackupRequest. * @param [properties] Properties to set */ - constructor(properties?: google.bigtable.admin.v2.IRestoreInfo); + constructor(properties?: google.bigtable.admin.v2.ICopyBackupRequest); - /** RestoreInfo sourceType. */ - public sourceType: (google.bigtable.admin.v2.RestoreSourceType|keyof typeof google.bigtable.admin.v2.RestoreSourceType); + /** CopyBackupRequest parent. */ + public parent: string; - /** RestoreInfo backupInfo. */ - public backupInfo?: (google.bigtable.admin.v2.IBackupInfo|null); + /** CopyBackupRequest backupId. */ + public backupId: string; - /** RestoreInfo sourceInfo. */ - public sourceInfo?: "backupInfo"; + /** CopyBackupRequest sourceBackup. */ + public sourceBackup: string; + + /** CopyBackupRequest expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new RestoreInfo instance using the specified properties. + * Creates a new CopyBackupRequest instance using the specified properties. * @param [properties] Properties to set - * @returns RestoreInfo instance + * @returns CopyBackupRequest instance */ - public static create(properties?: google.bigtable.admin.v2.IRestoreInfo): google.bigtable.admin.v2.RestoreInfo; + public static create(properties?: google.bigtable.admin.v2.ICopyBackupRequest): google.bigtable.admin.v2.CopyBackupRequest; /** - * Encodes the specified RestoreInfo message. Does not implicitly {@link google.bigtable.admin.v2.RestoreInfo.verify|verify} messages. - * @param message RestoreInfo message or plain object to encode + * Encodes the specified CopyBackupRequest message. Does not implicitly {@link google.bigtable.admin.v2.CopyBackupRequest.verify|verify} messages. + * @param message CopyBackupRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.bigtable.admin.v2.IRestoreInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.bigtable.admin.v2.ICopyBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RestoreInfo message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.RestoreInfo.verify|verify} messages. - * @param message RestoreInfo message or plain object to encode + * Encodes the specified CopyBackupRequest message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.CopyBackupRequest.verify|verify} messages. + * @param message CopyBackupRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.bigtable.admin.v2.IRestoreInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.bigtable.admin.v2.ICopyBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RestoreInfo message from the specified reader or buffer. + * Decodes a CopyBackupRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RestoreInfo + * @returns CopyBackupRequest * @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.bigtable.admin.v2.RestoreInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.bigtable.admin.v2.CopyBackupRequest; /** - * Decodes a RestoreInfo message from the specified reader or buffer, length delimited. + * Decodes a CopyBackupRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RestoreInfo + * @returns CopyBackupRequest * @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.bigtable.admin.v2.RestoreInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.bigtable.admin.v2.CopyBackupRequest; /** - * Verifies a RestoreInfo message. + * Verifies a CopyBackupRequest 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 RestoreInfo message from a plain object. Also converts values to their respective internal types. + * Creates a CopyBackupRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RestoreInfo + * @returns CopyBackupRequest */ - public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.RestoreInfo; + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.CopyBackupRequest; /** - * Creates a plain object from a RestoreInfo message. Also converts values to other types if specified. - * @param message RestoreInfo + * Creates a plain object from a CopyBackupRequest message. Also converts values to other types if specified. + * @param message CopyBackupRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.bigtable.admin.v2.RestoreInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.bigtable.admin.v2.CopyBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RestoreInfo to JSON. + * Converts this CopyBackupRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Table. */ - interface ITable { + /** Properties of a CopyBackupMetadata. */ + interface ICopyBackupMetadata { - /** Table name */ + /** CopyBackupMetadata name */ name?: (string|null); - /** Table clusterStates */ - clusterStates?: ({ [k: string]: google.bigtable.admin.v2.Table.IClusterState }|null); - - /** Table columnFamilies */ - columnFamilies?: ({ [k: string]: google.bigtable.admin.v2.IColumnFamily }|null); - - /** Table granularity */ - granularity?: (google.bigtable.admin.v2.Table.TimestampGranularity|keyof typeof google.bigtable.admin.v2.Table.TimestampGranularity|null); + /** CopyBackupMetadata sourceBackup */ + sourceBackup?: (string|null); - /** Table restoreInfo */ - restoreInfo?: (google.bigtable.admin.v2.IRestoreInfo|null); + /** CopyBackupMetadata progress */ + progress?: (google.bigtable.admin.v2.IOperationProgress|null); } - /** Represents a Table. */ - class Table implements ITable { + /** Represents a CopyBackupMetadata. */ + class CopyBackupMetadata implements ICopyBackupMetadata { /** - * Constructs a new Table. + * Constructs a new CopyBackupMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.bigtable.admin.v2.ITable); + constructor(properties?: google.bigtable.admin.v2.ICopyBackupMetadata); - /** Table name. */ + /** CopyBackupMetadata name. */ public name: string; - /** Table clusterStates. */ - public clusterStates: { [k: string]: google.bigtable.admin.v2.Table.IClusterState }; - - /** Table columnFamilies. */ - public columnFamilies: { [k: string]: google.bigtable.admin.v2.IColumnFamily }; - - /** Table granularity. */ - public granularity: (google.bigtable.admin.v2.Table.TimestampGranularity|keyof typeof google.bigtable.admin.v2.Table.TimestampGranularity); + /** CopyBackupMetadata sourceBackup. */ + public sourceBackup: string; - /** Table restoreInfo. */ - public restoreInfo?: (google.bigtable.admin.v2.IRestoreInfo|null); + /** CopyBackupMetadata progress. */ + public progress?: (google.bigtable.admin.v2.IOperationProgress|null); /** - * Creates a new Table instance using the specified properties. + * Creates a new CopyBackupMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns Table instance + * @returns CopyBackupMetadata instance */ - public static create(properties?: google.bigtable.admin.v2.ITable): google.bigtable.admin.v2.Table; + public static create(properties?: google.bigtable.admin.v2.ICopyBackupMetadata): google.bigtable.admin.v2.CopyBackupMetadata; /** - * Encodes the specified Table message. Does not implicitly {@link google.bigtable.admin.v2.Table.verify|verify} messages. - * @param message Table message or plain object to encode + * Encodes the specified CopyBackupMetadata message. Does not implicitly {@link google.bigtable.admin.v2.CopyBackupMetadata.verify|verify} messages. + * @param message CopyBackupMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.bigtable.admin.v2.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.bigtable.admin.v2.ICopyBackupMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Table message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.Table.verify|verify} messages. - * @param message Table message or plain object to encode + * Encodes the specified CopyBackupMetadata message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.CopyBackupMetadata.verify|verify} messages. + * @param message CopyBackupMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.bigtable.admin.v2.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.bigtable.admin.v2.ICopyBackupMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Table message from the specified reader or buffer. + * Decodes a CopyBackupMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Table + * @returns CopyBackupMetadata * @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.bigtable.admin.v2.Table; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.bigtable.admin.v2.CopyBackupMetadata; /** - * Decodes a Table message from the specified reader or buffer, length delimited. + * Decodes a CopyBackupMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Table + * @returns CopyBackupMetadata * @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.bigtable.admin.v2.Table; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.bigtable.admin.v2.CopyBackupMetadata; /** - * Verifies a Table message. + * Verifies a CopyBackupMetadata 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 Table message from a plain object. Also converts values to their respective internal types. + * Creates a CopyBackupMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Table + * @returns CopyBackupMetadata */ - public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.Table; + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.CopyBackupMetadata; /** - * Creates a plain object from a Table message. Also converts values to other types if specified. - * @param message Table + * Creates a plain object from a CopyBackupMetadata message. Also converts values to other types if specified. + * @param message CopyBackupMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.CopyBackupMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CopyBackupMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RestoreInfo. */ + interface IRestoreInfo { + + /** RestoreInfo sourceType */ + sourceType?: (google.bigtable.admin.v2.RestoreSourceType|keyof typeof google.bigtable.admin.v2.RestoreSourceType|null); + + /** RestoreInfo backupInfo */ + backupInfo?: (google.bigtable.admin.v2.IBackupInfo|null); + } + + /** Represents a RestoreInfo. */ + class RestoreInfo implements IRestoreInfo { + + /** + * Constructs a new RestoreInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.IRestoreInfo); + + /** RestoreInfo sourceType. */ + public sourceType: (google.bigtable.admin.v2.RestoreSourceType|keyof typeof google.bigtable.admin.v2.RestoreSourceType); + + /** RestoreInfo backupInfo. */ + public backupInfo?: (google.bigtable.admin.v2.IBackupInfo|null); + + /** RestoreInfo sourceInfo. */ + public sourceInfo?: "backupInfo"; + + /** + * Creates a new RestoreInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns RestoreInfo instance + */ + public static create(properties?: google.bigtable.admin.v2.IRestoreInfo): google.bigtable.admin.v2.RestoreInfo; + + /** + * Encodes the specified RestoreInfo message. Does not implicitly {@link google.bigtable.admin.v2.RestoreInfo.verify|verify} messages. + * @param message RestoreInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.IRestoreInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RestoreInfo message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.RestoreInfo.verify|verify} messages. + * @param message RestoreInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.IRestoreInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RestoreInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RestoreInfo + * @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.bigtable.admin.v2.RestoreInfo; + + /** + * Decodes a RestoreInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RestoreInfo + * @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.bigtable.admin.v2.RestoreInfo; + + /** + * Verifies a RestoreInfo 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 RestoreInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RestoreInfo + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.RestoreInfo; + + /** + * Creates a plain object from a RestoreInfo message. Also converts values to other types if specified. + * @param message RestoreInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.RestoreInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RestoreInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Table. */ + interface ITable { + + /** Table name */ + name?: (string|null); + + /** Table clusterStates */ + clusterStates?: ({ [k: string]: google.bigtable.admin.v2.Table.IClusterState }|null); + + /** Table columnFamilies */ + columnFamilies?: ({ [k: string]: google.bigtable.admin.v2.IColumnFamily }|null); + + /** Table granularity */ + granularity?: (google.bigtable.admin.v2.Table.TimestampGranularity|keyof typeof google.bigtable.admin.v2.Table.TimestampGranularity|null); + + /** Table restoreInfo */ + restoreInfo?: (google.bigtable.admin.v2.IRestoreInfo|null); + } + + /** Represents a Table. */ + class Table implements ITable { + + /** + * Constructs a new Table. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.ITable); + + /** Table name. */ + public name: string; + + /** Table clusterStates. */ + public clusterStates: { [k: string]: google.bigtable.admin.v2.Table.IClusterState }; + + /** Table columnFamilies. */ + public columnFamilies: { [k: string]: google.bigtable.admin.v2.IColumnFamily }; + + /** Table granularity. */ + public granularity: (google.bigtable.admin.v2.Table.TimestampGranularity|keyof typeof google.bigtable.admin.v2.Table.TimestampGranularity); + + /** Table restoreInfo. */ + public restoreInfo?: (google.bigtable.admin.v2.IRestoreInfo|null); + + /** + * Creates a new Table instance using the specified properties. + * @param [properties] Properties to set + * @returns Table instance + */ + public static create(properties?: google.bigtable.admin.v2.ITable): google.bigtable.admin.v2.Table; + + /** + * Encodes the specified Table message. Does not implicitly {@link google.bigtable.admin.v2.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Table message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Table message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Table + * @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.bigtable.admin.v2.Table; + + /** + * Decodes a Table message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Table + * @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.bigtable.admin.v2.Table; + + /** + * Verifies a Table 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 Table message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Table + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.Table; + + /** + * Creates a plain object from a Table message. Also converts values to other types if specified. + * @param message Table * @param [options] Conversion options * @returns Plain object */ @@ -9383,49 +9842,49 @@ export namespace google { namespace Bigtable { /** - * Callback as used by {@link google.bigtable.v2.Bigtable#readRows}. + * Callback as used by {@link google.bigtable.v2.Bigtable|readRows}. * @param error Error, if any * @param [response] ReadRowsResponse */ type ReadRowsCallback = (error: (Error|null), response?: google.bigtable.v2.ReadRowsResponse) => void; /** - * Callback as used by {@link google.bigtable.v2.Bigtable#sampleRowKeys}. + * Callback as used by {@link google.bigtable.v2.Bigtable|sampleRowKeys}. * @param error Error, if any * @param [response] SampleRowKeysResponse */ type SampleRowKeysCallback = (error: (Error|null), response?: google.bigtable.v2.SampleRowKeysResponse) => void; /** - * Callback as used by {@link google.bigtable.v2.Bigtable#mutateRow}. + * Callback as used by {@link google.bigtable.v2.Bigtable|mutateRow}. * @param error Error, if any * @param [response] MutateRowResponse */ type MutateRowCallback = (error: (Error|null), response?: google.bigtable.v2.MutateRowResponse) => void; /** - * Callback as used by {@link google.bigtable.v2.Bigtable#mutateRows}. + * Callback as used by {@link google.bigtable.v2.Bigtable|mutateRows}. * @param error Error, if any * @param [response] MutateRowsResponse */ type MutateRowsCallback = (error: (Error|null), response?: google.bigtable.v2.MutateRowsResponse) => void; /** - * Callback as used by {@link google.bigtable.v2.Bigtable#checkAndMutateRow}. + * Callback as used by {@link google.bigtable.v2.Bigtable|checkAndMutateRow}. * @param error Error, if any * @param [response] CheckAndMutateRowResponse */ type CheckAndMutateRowCallback = (error: (Error|null), response?: google.bigtable.v2.CheckAndMutateRowResponse) => void; /** - * Callback as used by {@link google.bigtable.v2.Bigtable#pingAndWarm}. + * Callback as used by {@link google.bigtable.v2.Bigtable|pingAndWarm}. * @param error Error, if any * @param [response] PingAndWarmResponse */ type PingAndWarmCallback = (error: (Error|null), response?: google.bigtable.v2.PingAndWarmResponse) => void; /** - * Callback as used by {@link google.bigtable.v2.Bigtable#readModifyWriteRow}. + * Callback as used by {@link google.bigtable.v2.Bigtable|readModifyWriteRow}. * @param error Error, if any * @param [response] ReadModifyWriteRowResponse */ @@ -15808,6 +16267,9 @@ export namespace google { /** FieldOptions lazy */ lazy?: (boolean|null); + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + /** FieldOptions deprecated */ deprecated?: (boolean|null); @@ -15845,6 +16307,9 @@ export namespace google { /** FieldOptions lazy. */ public lazy: boolean; + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: boolean; + /** FieldOptions deprecated. */ public deprecated: boolean; @@ -17185,53 +17650,143 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of an Any. */ - interface IAny { - - /** Any type_url */ - type_url?: (string|null); + /** Properties of a FieldMask. */ + interface IFieldMask { - /** Any value */ - value?: (Uint8Array|string|null); + /** FieldMask paths */ + paths?: (string[]|null); } - /** Represents an Any. */ - class Any implements IAny { + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { /** - * Constructs a new Any. + * Constructs a new FieldMask. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IAny); - - /** Any type_url. */ - public type_url: string; + constructor(properties?: google.protobuf.IFieldMask); - /** Any value. */ - public value: (Uint8Array|string); + /** FieldMask paths. */ + public paths: string[]; /** - * Creates a new Any instance using the specified properties. + * Creates a new FieldMask instance using the specified properties. * @param [properties] Properties to set - * @returns Any instance + * @returns FieldMask instance */ - public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; /** - * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @param message Any message or plain object to encode + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @param message Any message or plain object to encode + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @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.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @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.protobuf.FieldMask; + + /** + * Verifies a FieldMask 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 FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes an Any message from the specified reader or buffer. @@ -17461,96 +18016,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a FieldMask. */ - interface IFieldMask { - - /** FieldMask paths */ - paths?: (string[]|null); - } - - /** Represents a FieldMask. */ - class FieldMask implements IFieldMask { - - /** - * Constructs a new FieldMask. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFieldMask); - - /** FieldMask paths. */ - public paths: string[]; - - /** - * Creates a new FieldMask instance using the specified properties. - * @param [properties] Properties to set - * @returns FieldMask instance - */ - public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; - - /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldMask message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FieldMask - * @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.protobuf.FieldMask; - - /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FieldMask - * @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.protobuf.FieldMask; - - /** - * Verifies a FieldMask 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 FieldMask message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FieldMask - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; - - /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @param message FieldMask - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FieldMask to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - /** Properties of a DoubleValue. */ interface IDoubleValue { @@ -18434,21 +18899,21 @@ export namespace google { namespace IAMPolicy { /** - * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|setIamPolicy}. * @param error Error, if any * @param [response] Policy */ type SetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|getIamPolicy}. * @param error Error, if any * @param [response] Policy */ type GetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * Callback as used by {@link google.iam.v1.IAMPolicy|testIamPermissions}. * @param error Error, if any * @param [response] TestIamPermissionsResponse */ @@ -18463,6 +18928,9 @@ export namespace google { /** SetIamPolicyRequest policy */ policy?: (google.iam.v1.IPolicy|null); + + /** SetIamPolicyRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } /** Represents a SetIamPolicyRequest. */ @@ -18480,6 +18948,9 @@ export namespace google { /** SetIamPolicyRequest policy. */ public policy?: (google.iam.v1.IPolicy|null); + /** SetIamPolicyRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + /** * Creates a new SetIamPolicyRequest instance using the specified properties. * @param [properties] Properties to set @@ -18932,6 +19403,9 @@ export namespace google { /** Policy bindings */ bindings?: (google.iam.v1.IBinding[]|null); + /** Policy auditConfigs */ + auditConfigs?: (google.iam.v1.IAuditConfig[]|null); + /** Policy etag */ etag?: (Uint8Array|string|null); } @@ -18951,6 +19425,9 @@ export namespace google { /** Policy bindings. */ public bindings: google.iam.v1.IBinding[]; + /** Policy auditConfigs. */ + public auditConfigs: google.iam.v1.IAuditConfig[]; + /** Policy etag. */ public etag: (Uint8Array|string); @@ -19127,6 +19604,209 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an AuditConfig. */ + interface IAuditConfig { + + /** AuditConfig service */ + service?: (string|null); + + /** AuditConfig auditLogConfigs */ + auditLogConfigs?: (google.iam.v1.IAuditLogConfig[]|null); + } + + /** Represents an AuditConfig. */ + class AuditConfig implements IAuditConfig { + + /** + * Constructs a new AuditConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IAuditConfig); + + /** AuditConfig service. */ + public service: string; + + /** AuditConfig auditLogConfigs. */ + public auditLogConfigs: google.iam.v1.IAuditLogConfig[]; + + /** + * Creates a new AuditConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AuditConfig instance + */ + public static create(properties?: google.iam.v1.IAuditConfig): google.iam.v1.AuditConfig; + + /** + * Encodes the specified AuditConfig message. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @param message AuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AuditConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @param message AuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AuditConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AuditConfig + * @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.iam.v1.AuditConfig; + + /** + * Decodes an AuditConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AuditConfig + * @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.iam.v1.AuditConfig; + + /** + * Verifies an AuditConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AuditConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AuditConfig + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.AuditConfig; + + /** + * Creates a plain object from an AuditConfig message. Also converts values to other types if specified. + * @param message AuditConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.AuditConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AuditConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AuditLogConfig. */ + interface IAuditLogConfig { + + /** AuditLogConfig logType */ + logType?: (google.iam.v1.AuditLogConfig.LogType|keyof typeof google.iam.v1.AuditLogConfig.LogType|null); + + /** AuditLogConfig exemptedMembers */ + exemptedMembers?: (string[]|null); + } + + /** Represents an AuditLogConfig. */ + class AuditLogConfig implements IAuditLogConfig { + + /** + * Constructs a new AuditLogConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IAuditLogConfig); + + /** AuditLogConfig logType. */ + public logType: (google.iam.v1.AuditLogConfig.LogType|keyof typeof google.iam.v1.AuditLogConfig.LogType); + + /** AuditLogConfig exemptedMembers. */ + public exemptedMembers: string[]; + + /** + * Creates a new AuditLogConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AuditLogConfig instance + */ + public static create(properties?: google.iam.v1.IAuditLogConfig): google.iam.v1.AuditLogConfig; + + /** + * Encodes the specified AuditLogConfig message. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @param message AuditLogConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IAuditLogConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AuditLogConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @param message AuditLogConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IAuditLogConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AuditLogConfig + * @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.iam.v1.AuditLogConfig; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AuditLogConfig + * @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.iam.v1.AuditLogConfig; + + /** + * Verifies an AuditLogConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AuditLogConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AuditLogConfig + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.AuditLogConfig; + + /** + * Creates a plain object from an AuditLogConfig message. Also converts values to other types if specified. + * @param message AuditLogConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.AuditLogConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AuditLogConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace AuditLogConfig { + + /** LogType enum. */ + enum LogType { + LOG_TYPE_UNSPECIFIED = 0, + ADMIN_READ = 1, + DATA_WRITE = 2, + DATA_READ = 3 + } + } + /** Properties of a PolicyDelta. */ interface IPolicyDelta { @@ -19670,35 +20350,35 @@ export namespace google { namespace Operations { /** - * Callback as used by {@link google.longrunning.Operations#listOperations}. + * Callback as used by {@link google.longrunning.Operations|listOperations}. * @param error Error, if any * @param [response] ListOperationsResponse */ type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; /** - * Callback as used by {@link google.longrunning.Operations#getOperation}. + * Callback as used by {@link google.longrunning.Operations|getOperation}. * @param error Error, if any * @param [response] Operation */ type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. * @param error Error, if any * @param [response] Empty */ type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. * @param error Error, if any * @param [response] Empty */ type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * Callback as used by {@link google.longrunning.Operations|waitOperation}. * @param error Error, if any * @param [response] Operation */ diff --git a/protos/protos.js b/protos/protos.js index f41e06fd0..44054590b 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -99,7 +99,7 @@ }; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#createInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|createInstance}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef CreateInstanceCallback * @type {function} @@ -132,7 +132,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#getInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|getInstance}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef GetInstanceCallback * @type {function} @@ -165,7 +165,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listInstances}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|listInstances}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef ListInstancesCallback * @type {function} @@ -198,7 +198,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#updateInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|updateInstance}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef UpdateInstanceCallback * @type {function} @@ -231,7 +231,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#partialUpdateInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|partialUpdateInstance}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef PartialUpdateInstanceCallback * @type {function} @@ -264,7 +264,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#deleteInstance}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|deleteInstance}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef DeleteInstanceCallback * @type {function} @@ -297,7 +297,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#createCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|createCluster}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef CreateClusterCallback * @type {function} @@ -330,7 +330,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#getCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|getCluster}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef GetClusterCallback * @type {function} @@ -363,7 +363,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listClusters}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|listClusters}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef ListClustersCallback * @type {function} @@ -396,7 +396,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#updateCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|updateCluster}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef UpdateClusterCallback * @type {function} @@ -429,7 +429,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#partialUpdateCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|partialUpdateCluster}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef PartialUpdateClusterCallback * @type {function} @@ -462,7 +462,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#deleteCluster}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|deleteCluster}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef DeleteClusterCallback * @type {function} @@ -495,7 +495,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#createAppProfile}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|createAppProfile}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef CreateAppProfileCallback * @type {function} @@ -528,7 +528,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#getAppProfile}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|getAppProfile}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef GetAppProfileCallback * @type {function} @@ -561,7 +561,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listAppProfiles}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|listAppProfiles}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef ListAppProfilesCallback * @type {function} @@ -594,7 +594,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#updateAppProfile}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|updateAppProfile}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef UpdateAppProfileCallback * @type {function} @@ -627,7 +627,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#deleteAppProfile}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|deleteAppProfile}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef DeleteAppProfileCallback * @type {function} @@ -660,7 +660,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#getIamPolicy}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|getIamPolicy}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef GetIamPolicyCallback * @type {function} @@ -693,7 +693,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#setIamPolicy}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|setIamPolicy}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef SetIamPolicyCallback * @type {function} @@ -726,7 +726,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#testIamPermissions}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|testIamPermissions}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef TestIamPermissionsCallback * @type {function} @@ -759,7 +759,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listHotTablets}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin|listHotTablets}. * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin * @typedef ListHotTabletsCallback * @type {function} @@ -7178,6 +7178,7 @@ * @property {google.bigtable.admin.v2.Instance.Type|null} [type] Instance type * @property {Object.|null} [labels] Instance labels * @property {google.protobuf.ITimestamp|null} [createTime] Instance createTime + * @property {boolean|null} [satisfiesPzs] Instance satisfiesPzs */ /** @@ -7244,6 +7245,28 @@ */ Instance.prototype.createTime = null; + /** + * Instance satisfiesPzs. + * @member {boolean|null|undefined} satisfiesPzs + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.satisfiesPzs = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Instance _satisfiesPzs. + * @member {"satisfiesPzs"|undefined} _satisfiesPzs + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Object.defineProperty(Instance.prototype, "_satisfiesPzs", { + get: $util.oneOfGetter($oneOfFields = ["satisfiesPzs"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new Instance instance using the specified properties. * @function create @@ -7281,6 +7304,8 @@ writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.satisfiesPzs); return writer; }; @@ -7352,6 +7377,9 @@ case 7: message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; + case 8: + message.satisfiesPzs = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -7387,6 +7415,7 @@ Instance.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -7424,6 +7453,11 @@ if (error) return "createTime." + error; } + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { + properties._satisfiesPzs = 1; + if (typeof message.satisfiesPzs !== "boolean") + return "satisfiesPzs: boolean expected"; + } return null; }; @@ -7483,6 +7517,8 @@ throw TypeError(".google.bigtable.admin.v2.Instance.createTime: object expected"); message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } + if (object.satisfiesPzs != null) + message.satisfiesPzs = Boolean(object.satisfiesPzs); return message; }; @@ -7524,6 +7560,11 @@ } if (message.createTime != null && message.hasOwnProperty("createTime")) object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { + object.satisfiesPzs = message.satisfiesPzs; + if (options.oneofs) + object._satisfiesPzs = "satisfiesPzs"; + } return object; }; @@ -7580,6 +7621,7 @@ * @memberof google.bigtable.admin.v2 * @interface IAutoscalingTargets * @property {number|null} [cpuUtilizationPercent] AutoscalingTargets cpuUtilizationPercent + * @property {number|null} [storageUtilizationGibPerNode] AutoscalingTargets storageUtilizationGibPerNode */ /** @@ -7605,6 +7647,14 @@ */ AutoscalingTargets.prototype.cpuUtilizationPercent = 0; + /** + * AutoscalingTargets storageUtilizationGibPerNode. + * @member {number} storageUtilizationGibPerNode + * @memberof google.bigtable.admin.v2.AutoscalingTargets + * @instance + */ + AutoscalingTargets.prototype.storageUtilizationGibPerNode = 0; + /** * Creates a new AutoscalingTargets instance using the specified properties. * @function create @@ -7631,6 +7681,8 @@ writer = $Writer.create(); if (message.cpuUtilizationPercent != null && Object.hasOwnProperty.call(message, "cpuUtilizationPercent")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.cpuUtilizationPercent); + if (message.storageUtilizationGibPerNode != null && Object.hasOwnProperty.call(message, "storageUtilizationGibPerNode")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.storageUtilizationGibPerNode); return writer; }; @@ -7668,6 +7720,9 @@ case 2: message.cpuUtilizationPercent = reader.int32(); break; + case 3: + message.storageUtilizationGibPerNode = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -7706,6 +7761,9 @@ if (message.cpuUtilizationPercent != null && message.hasOwnProperty("cpuUtilizationPercent")) if (!$util.isInteger(message.cpuUtilizationPercent)) return "cpuUtilizationPercent: integer expected"; + if (message.storageUtilizationGibPerNode != null && message.hasOwnProperty("storageUtilizationGibPerNode")) + if (!$util.isInteger(message.storageUtilizationGibPerNode)) + return "storageUtilizationGibPerNode: integer expected"; return null; }; @@ -7723,6 +7781,8 @@ var message = new $root.google.bigtable.admin.v2.AutoscalingTargets(); if (object.cpuUtilizationPercent != null) message.cpuUtilizationPercent = object.cpuUtilizationPercent | 0; + if (object.storageUtilizationGibPerNode != null) + message.storageUtilizationGibPerNode = object.storageUtilizationGibPerNode | 0; return message; }; @@ -7739,10 +7799,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.cpuUtilizationPercent = 0; + object.storageUtilizationGibPerNode = 0; + } if (message.cpuUtilizationPercent != null && message.hasOwnProperty("cpuUtilizationPercent")) object.cpuUtilizationPercent = message.cpuUtilizationPercent; + if (message.storageUtilizationGibPerNode != null && message.hasOwnProperty("storageUtilizationGibPerNode")) + object.storageUtilizationGibPerNode = message.storageUtilizationGibPerNode; return object; }; @@ -10332,7 +10396,7 @@ }; /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#createTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|createTable}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef CreateTableCallback * @type {function} @@ -10365,7 +10429,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#createTableFromSnapshot}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|createTableFromSnapshot}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef CreateTableFromSnapshotCallback * @type {function} @@ -10398,7 +10462,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#listTables}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|listTables}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef ListTablesCallback * @type {function} @@ -10431,7 +10495,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#getTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|getTable}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef GetTableCallback * @type {function} @@ -10464,7 +10528,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#deleteTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|deleteTable}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef DeleteTableCallback * @type {function} @@ -10497,7 +10561,40 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#modifyColumnFamilies}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|undeleteTable}. + * @memberof google.bigtable.admin.v2.BigtableTableAdmin + * @typedef UndeleteTableCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UndeleteTable. + * @function undeleteTable + * @memberof google.bigtable.admin.v2.BigtableTableAdmin + * @instance + * @param {google.bigtable.admin.v2.IUndeleteTableRequest} request UndeleteTableRequest message or plain object + * @param {google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTableCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(BigtableTableAdmin.prototype.undeleteTable = function undeleteTable(request, callback) { + return this.rpcCall(undeleteTable, $root.google.bigtable.admin.v2.UndeleteTableRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UndeleteTable" }); + + /** + * Calls UndeleteTable. + * @function undeleteTable + * @memberof google.bigtable.admin.v2.BigtableTableAdmin + * @instance + * @param {google.bigtable.admin.v2.IUndeleteTableRequest} request UndeleteTableRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|modifyColumnFamilies}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef ModifyColumnFamiliesCallback * @type {function} @@ -10530,7 +10627,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#dropRowRange}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|dropRowRange}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef DropRowRangeCallback * @type {function} @@ -10563,7 +10660,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#generateConsistencyToken}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|generateConsistencyToken}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef GenerateConsistencyTokenCallback * @type {function} @@ -10596,7 +10693,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#checkConsistency}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|checkConsistency}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef CheckConsistencyCallback * @type {function} @@ -10629,7 +10726,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#snapshotTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|snapshotTable}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef SnapshotTableCallback * @type {function} @@ -10662,7 +10759,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#getSnapshot}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|getSnapshot}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef GetSnapshotCallback * @type {function} @@ -10695,7 +10792,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#listSnapshots}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|listSnapshots}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef ListSnapshotsCallback * @type {function} @@ -10728,7 +10825,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#deleteSnapshot}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|deleteSnapshot}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef DeleteSnapshotCallback * @type {function} @@ -10761,7 +10858,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#createBackup}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|createBackup}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef CreateBackupCallback * @type {function} @@ -10794,7 +10891,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#getBackup}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|getBackup}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef GetBackupCallback * @type {function} @@ -10827,7 +10924,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#updateBackup}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|updateBackup}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef UpdateBackupCallback * @type {function} @@ -10860,7 +10957,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#deleteBackup}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|deleteBackup}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef DeleteBackupCallback * @type {function} @@ -10893,7 +10990,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#listBackups}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|listBackups}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef ListBackupsCallback * @type {function} @@ -10926,7 +11023,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#restoreTable}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|restoreTable}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef RestoreTableCallback * @type {function} @@ -10959,7 +11056,40 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#getIamPolicy}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|copyBackup}. + * @memberof google.bigtable.admin.v2.BigtableTableAdmin + * @typedef CopyBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CopyBackup. + * @function copyBackup + * @memberof google.bigtable.admin.v2.BigtableTableAdmin + * @instance + * @param {google.bigtable.admin.v2.ICopyBackupRequest} request CopyBackupRequest message or plain object + * @param {google.bigtable.admin.v2.BigtableTableAdmin.CopyBackupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(BigtableTableAdmin.prototype.copyBackup = function copyBackup(request, callback) { + return this.rpcCall(copyBackup, $root.google.bigtable.admin.v2.CopyBackupRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CopyBackup" }); + + /** + * Calls CopyBackup. + * @function copyBackup + * @memberof google.bigtable.admin.v2.BigtableTableAdmin + * @instance + * @param {google.bigtable.admin.v2.ICopyBackupRequest} request CopyBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|getIamPolicy}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef GetIamPolicyCallback * @type {function} @@ -10992,7 +11122,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#setIamPolicy}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|setIamPolicy}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef SetIamPolicyCallback * @type {function} @@ -11025,7 +11155,7 @@ */ /** - * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin#testIamPermissions}. + * Callback as used by {@link google.bigtable.admin.v2.BigtableTableAdmin|testIamPermissions}. * @memberof google.bigtable.admin.v2.BigtableTableAdmin * @typedef TestIamPermissionsCallback * @type {function} @@ -13761,6 +13891,435 @@ return DeleteTableRequest; })(); + v2.UndeleteTableRequest = (function() { + + /** + * Properties of an UndeleteTableRequest. + * @memberof google.bigtable.admin.v2 + * @interface IUndeleteTableRequest + * @property {string|null} [name] UndeleteTableRequest name + */ + + /** + * Constructs a new UndeleteTableRequest. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents an UndeleteTableRequest. + * @implements IUndeleteTableRequest + * @constructor + * @param {google.bigtable.admin.v2.IUndeleteTableRequest=} [properties] Properties to set + */ + function UndeleteTableRequest(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]]; + } + + /** + * UndeleteTableRequest name. + * @member {string} name + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @instance + */ + UndeleteTableRequest.prototype.name = ""; + + /** + * Creates a new UndeleteTableRequest instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @static + * @param {google.bigtable.admin.v2.IUndeleteTableRequest=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.UndeleteTableRequest} UndeleteTableRequest instance + */ + UndeleteTableRequest.create = function create(properties) { + return new UndeleteTableRequest(properties); + }; + + /** + * Encodes the specified UndeleteTableRequest message. Does not implicitly {@link google.bigtable.admin.v2.UndeleteTableRequest.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @static + * @param {google.bigtable.admin.v2.IUndeleteTableRequest} message UndeleteTableRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeleteTableRequest.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); + return writer; + }; + + /** + * Encodes the specified UndeleteTableRequest message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.UndeleteTableRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @static + * @param {google.bigtable.admin.v2.IUndeleteTableRequest} message UndeleteTableRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeleteTableRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeleteTableRequest message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.UndeleteTableRequest} UndeleteTableRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeleteTableRequest.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.bigtable.admin.v2.UndeleteTableRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UndeleteTableRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.UndeleteTableRequest} UndeleteTableRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeleteTableRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeleteTableRequest message. + * @function verify + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeleteTableRequest.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"; + return null; + }; + + /** + * Creates an UndeleteTableRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.UndeleteTableRequest} UndeleteTableRequest + */ + UndeleteTableRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.UndeleteTableRequest) + return object; + var message = new $root.google.bigtable.admin.v2.UndeleteTableRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an UndeleteTableRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @static + * @param {google.bigtable.admin.v2.UndeleteTableRequest} message UndeleteTableRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeleteTableRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this UndeleteTableRequest to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.UndeleteTableRequest + * @instance + * @returns {Object.} JSON object + */ + UndeleteTableRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeleteTableRequest; + })(); + + v2.UndeleteTableMetadata = (function() { + + /** + * Properties of an UndeleteTableMetadata. + * @memberof google.bigtable.admin.v2 + * @interface IUndeleteTableMetadata + * @property {string|null} [name] UndeleteTableMetadata name + * @property {google.protobuf.ITimestamp|null} [startTime] UndeleteTableMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] UndeleteTableMetadata endTime + */ + + /** + * Constructs a new UndeleteTableMetadata. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents an UndeleteTableMetadata. + * @implements IUndeleteTableMetadata + * @constructor + * @param {google.bigtable.admin.v2.IUndeleteTableMetadata=} [properties] Properties to set + */ + function UndeleteTableMetadata(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]]; + } + + /** + * UndeleteTableMetadata name. + * @member {string} name + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @instance + */ + UndeleteTableMetadata.prototype.name = ""; + + /** + * UndeleteTableMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @instance + */ + UndeleteTableMetadata.prototype.startTime = null; + + /** + * UndeleteTableMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @instance + */ + UndeleteTableMetadata.prototype.endTime = null; + + /** + * Creates a new UndeleteTableMetadata instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @static + * @param {google.bigtable.admin.v2.IUndeleteTableMetadata=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.UndeleteTableMetadata} UndeleteTableMetadata instance + */ + UndeleteTableMetadata.create = function create(properties) { + return new UndeleteTableMetadata(properties); + }; + + /** + * Encodes the specified UndeleteTableMetadata message. Does not implicitly {@link google.bigtable.admin.v2.UndeleteTableMetadata.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @static + * @param {google.bigtable.admin.v2.IUndeleteTableMetadata} message UndeleteTableMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeleteTableMetadata.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.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UndeleteTableMetadata message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.UndeleteTableMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @static + * @param {google.bigtable.admin.v2.IUndeleteTableMetadata} message UndeleteTableMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeleteTableMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeleteTableMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.UndeleteTableMetadata} UndeleteTableMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeleteTableMetadata.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.bigtable.admin.v2.UndeleteTableMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UndeleteTableMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.UndeleteTableMetadata} UndeleteTableMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeleteTableMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeleteTableMetadata message. + * @function verify + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeleteTableMetadata.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.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates an UndeleteTableMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.UndeleteTableMetadata} UndeleteTableMetadata + */ + UndeleteTableMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.UndeleteTableMetadata) + return object; + var message = new $root.google.bigtable.admin.v2.UndeleteTableMetadata(); + if (object.name != null) + message.name = String(object.name); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.bigtable.admin.v2.UndeleteTableMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.bigtable.admin.v2.UndeleteTableMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from an UndeleteTableMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @static + * @param {google.bigtable.admin.v2.UndeleteTableMetadata} message UndeleteTableMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeleteTableMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.startTime = null; + object.endTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this UndeleteTableMetadata to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.UndeleteTableMetadata + * @instance + * @returns {Object.} JSON object + */ + UndeleteTableMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeleteTableMetadata; + })(); + v2.ModifyColumnFamiliesRequest = (function() { /** @@ -18273,6 +18832,502 @@ return ListBackupsResponse; })(); + v2.CopyBackupRequest = (function() { + + /** + * Properties of a CopyBackupRequest. + * @memberof google.bigtable.admin.v2 + * @interface ICopyBackupRequest + * @property {string|null} [parent] CopyBackupRequest parent + * @property {string|null} [backupId] CopyBackupRequest backupId + * @property {string|null} [sourceBackup] CopyBackupRequest sourceBackup + * @property {google.protobuf.ITimestamp|null} [expireTime] CopyBackupRequest expireTime + */ + + /** + * Constructs a new CopyBackupRequest. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents a CopyBackupRequest. + * @implements ICopyBackupRequest + * @constructor + * @param {google.bigtable.admin.v2.ICopyBackupRequest=} [properties] Properties to set + */ + function CopyBackupRequest(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]]; + } + + /** + * CopyBackupRequest parent. + * @member {string} parent + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @instance + */ + CopyBackupRequest.prototype.parent = ""; + + /** + * CopyBackupRequest backupId. + * @member {string} backupId + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @instance + */ + CopyBackupRequest.prototype.backupId = ""; + + /** + * CopyBackupRequest sourceBackup. + * @member {string} sourceBackup + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @instance + */ + CopyBackupRequest.prototype.sourceBackup = ""; + + /** + * CopyBackupRequest expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @instance + */ + CopyBackupRequest.prototype.expireTime = null; + + /** + * Creates a new CopyBackupRequest instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @static + * @param {google.bigtable.admin.v2.ICopyBackupRequest=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.CopyBackupRequest} CopyBackupRequest instance + */ + CopyBackupRequest.create = function create(properties) { + return new CopyBackupRequest(properties); + }; + + /** + * Encodes the specified CopyBackupRequest message. Does not implicitly {@link google.bigtable.admin.v2.CopyBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @static + * @param {google.bigtable.admin.v2.ICopyBackupRequest} message CopyBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.backupId != null && Object.hasOwnProperty.call(message, "backupId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.backupId); + if (message.sourceBackup != null && Object.hasOwnProperty.call(message, "sourceBackup")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sourceBackup); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CopyBackupRequest message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.CopyBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @static + * @param {google.bigtable.admin.v2.ICopyBackupRequest} message CopyBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CopyBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.CopyBackupRequest} CopyBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyBackupRequest.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.bigtable.admin.v2.CopyBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.backupId = reader.string(); + break; + case 3: + message.sourceBackup = reader.string(); + break; + case 4: + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CopyBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.CopyBackupRequest} CopyBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CopyBackupRequest message. + * @function verify + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CopyBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.backupId != null && message.hasOwnProperty("backupId")) + if (!$util.isString(message.backupId)) + return "backupId: string expected"; + if (message.sourceBackup != null && message.hasOwnProperty("sourceBackup")) + if (!$util.isString(message.sourceBackup)) + return "sourceBackup: string expected"; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + return null; + }; + + /** + * Creates a CopyBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.CopyBackupRequest} CopyBackupRequest + */ + CopyBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.CopyBackupRequest) + return object; + var message = new $root.google.bigtable.admin.v2.CopyBackupRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.backupId != null) + message.backupId = String(object.backupId); + if (object.sourceBackup != null) + message.sourceBackup = String(object.sourceBackup); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.bigtable.admin.v2.CopyBackupRequest.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + } + return message; + }; + + /** + * Creates a plain object from a CopyBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @static + * @param {google.bigtable.admin.v2.CopyBackupRequest} message CopyBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CopyBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.backupId = ""; + object.sourceBackup = ""; + object.expireTime = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.backupId != null && message.hasOwnProperty("backupId")) + object.backupId = message.backupId; + if (message.sourceBackup != null && message.hasOwnProperty("sourceBackup")) + object.sourceBackup = message.sourceBackup; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + return object; + }; + + /** + * Converts this CopyBackupRequest to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.CopyBackupRequest + * @instance + * @returns {Object.} JSON object + */ + CopyBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CopyBackupRequest; + })(); + + v2.CopyBackupMetadata = (function() { + + /** + * Properties of a CopyBackupMetadata. + * @memberof google.bigtable.admin.v2 + * @interface ICopyBackupMetadata + * @property {string|null} [name] CopyBackupMetadata name + * @property {string|null} [sourceBackup] CopyBackupMetadata sourceBackup + * @property {google.bigtable.admin.v2.IOperationProgress|null} [progress] CopyBackupMetadata progress + */ + + /** + * Constructs a new CopyBackupMetadata. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents a CopyBackupMetadata. + * @implements ICopyBackupMetadata + * @constructor + * @param {google.bigtable.admin.v2.ICopyBackupMetadata=} [properties] Properties to set + */ + function CopyBackupMetadata(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]]; + } + + /** + * CopyBackupMetadata name. + * @member {string} name + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @instance + */ + CopyBackupMetadata.prototype.name = ""; + + /** + * CopyBackupMetadata sourceBackup. + * @member {string} sourceBackup + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @instance + */ + CopyBackupMetadata.prototype.sourceBackup = ""; + + /** + * CopyBackupMetadata progress. + * @member {google.bigtable.admin.v2.IOperationProgress|null|undefined} progress + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @instance + */ + CopyBackupMetadata.prototype.progress = null; + + /** + * Creates a new CopyBackupMetadata instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @static + * @param {google.bigtable.admin.v2.ICopyBackupMetadata=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.CopyBackupMetadata} CopyBackupMetadata instance + */ + CopyBackupMetadata.create = function create(properties) { + return new CopyBackupMetadata(properties); + }; + + /** + * Encodes the specified CopyBackupMetadata message. Does not implicitly {@link google.bigtable.admin.v2.CopyBackupMetadata.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @static + * @param {google.bigtable.admin.v2.ICopyBackupMetadata} message CopyBackupMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyBackupMetadata.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.sourceBackup != null && Object.hasOwnProperty.call(message, "sourceBackup")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceBackup); + if (message.progress != null && Object.hasOwnProperty.call(message, "progress")) + $root.google.bigtable.admin.v2.OperationProgress.encode(message.progress, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CopyBackupMetadata message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.CopyBackupMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @static + * @param {google.bigtable.admin.v2.ICopyBackupMetadata} message CopyBackupMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyBackupMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CopyBackupMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.CopyBackupMetadata} CopyBackupMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyBackupMetadata.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.bigtable.admin.v2.CopyBackupMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.sourceBackup = reader.string(); + break; + case 3: + message.progress = $root.google.bigtable.admin.v2.OperationProgress.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CopyBackupMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.CopyBackupMetadata} CopyBackupMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyBackupMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CopyBackupMetadata message. + * @function verify + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CopyBackupMetadata.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.sourceBackup != null && message.hasOwnProperty("sourceBackup")) + if (!$util.isString(message.sourceBackup)) + return "sourceBackup: string expected"; + if (message.progress != null && message.hasOwnProperty("progress")) { + var error = $root.google.bigtable.admin.v2.OperationProgress.verify(message.progress); + if (error) + return "progress." + error; + } + return null; + }; + + /** + * Creates a CopyBackupMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.CopyBackupMetadata} CopyBackupMetadata + */ + CopyBackupMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.CopyBackupMetadata) + return object; + var message = new $root.google.bigtable.admin.v2.CopyBackupMetadata(); + if (object.name != null) + message.name = String(object.name); + if (object.sourceBackup != null) + message.sourceBackup = String(object.sourceBackup); + if (object.progress != null) { + if (typeof object.progress !== "object") + throw TypeError(".google.bigtable.admin.v2.CopyBackupMetadata.progress: object expected"); + message.progress = $root.google.bigtable.admin.v2.OperationProgress.fromObject(object.progress); + } + return message; + }; + + /** + * Creates a plain object from a CopyBackupMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @static + * @param {google.bigtable.admin.v2.CopyBackupMetadata} message CopyBackupMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CopyBackupMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.sourceBackup = ""; + object.progress = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.sourceBackup != null && message.hasOwnProperty("sourceBackup")) + object.sourceBackup = message.sourceBackup; + if (message.progress != null && message.hasOwnProperty("progress")) + object.progress = $root.google.bigtable.admin.v2.OperationProgress.toObject(message.progress, options); + return object; + }; + + /** + * Converts this CopyBackupMetadata to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.CopyBackupMetadata + * @instance + * @returns {Object.} JSON object + */ + CopyBackupMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CopyBackupMetadata; + })(); + v2.RestoreInfo = (function() { /** @@ -21526,7 +22581,7 @@ }; /** - * Callback as used by {@link google.bigtable.v2.Bigtable#readRows}. + * Callback as used by {@link google.bigtable.v2.Bigtable|readRows}. * @memberof google.bigtable.v2.Bigtable * @typedef ReadRowsCallback * @type {function} @@ -21559,7 +22614,7 @@ */ /** - * Callback as used by {@link google.bigtable.v2.Bigtable#sampleRowKeys}. + * Callback as used by {@link google.bigtable.v2.Bigtable|sampleRowKeys}. * @memberof google.bigtable.v2.Bigtable * @typedef SampleRowKeysCallback * @type {function} @@ -21592,7 +22647,7 @@ */ /** - * Callback as used by {@link google.bigtable.v2.Bigtable#mutateRow}. + * Callback as used by {@link google.bigtable.v2.Bigtable|mutateRow}. * @memberof google.bigtable.v2.Bigtable * @typedef MutateRowCallback * @type {function} @@ -21625,7 +22680,7 @@ */ /** - * Callback as used by {@link google.bigtable.v2.Bigtable#mutateRows}. + * Callback as used by {@link google.bigtable.v2.Bigtable|mutateRows}. * @memberof google.bigtable.v2.Bigtable * @typedef MutateRowsCallback * @type {function} @@ -21658,7 +22713,7 @@ */ /** - * Callback as used by {@link google.bigtable.v2.Bigtable#checkAndMutateRow}. + * Callback as used by {@link google.bigtable.v2.Bigtable|checkAndMutateRow}. * @memberof google.bigtable.v2.Bigtable * @typedef CheckAndMutateRowCallback * @type {function} @@ -21691,7 +22746,7 @@ */ /** - * Callback as used by {@link google.bigtable.v2.Bigtable#pingAndWarm}. + * Callback as used by {@link google.bigtable.v2.Bigtable|pingAndWarm}. * @memberof google.bigtable.v2.Bigtable * @typedef PingAndWarmCallback * @type {function} @@ -21724,7 +22779,7 @@ */ /** - * Callback as used by {@link google.bigtable.v2.Bigtable#readModifyWriteRow}. + * Callback as used by {@link google.bigtable.v2.Bigtable|readModifyWriteRow}. * @memberof google.bigtable.v2.Bigtable * @typedef ReadModifyWriteRowCallback * @type {function} @@ -38517,6 +39572,7 @@ * @property {boolean|null} [packed] FieldOptions packed * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy * @property {boolean|null} [deprecated] FieldOptions deprecated * @property {boolean|null} [weak] FieldOptions weak * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption @@ -38573,6 +39629,14 @@ */ FieldOptions.prototype.lazy = false; + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + /** * FieldOptions deprecated. * @member {boolean} deprecated @@ -38649,6 +39713,8 @@ writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -38706,6 +39772,9 @@ case 5: message.lazy = reader.bool(); break; + case 15: + message.unverifiedLazy = reader.bool(); + break; case 3: message.deprecated = reader.bool(); break; @@ -38789,6 +39858,9 @@ if (message.lazy != null && message.hasOwnProperty("lazy")) if (typeof message.lazy !== "boolean") return "lazy: boolean expected"; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; if (message.deprecated != null && message.hasOwnProperty("deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; @@ -38874,6 +39946,8 @@ } if (object.lazy != null) message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); if (object.weak != null) @@ -38961,6 +40035,7 @@ object.lazy = false; object.jstype = options.enums === String ? "JS_NORMAL" : 0; object.weak = false; + object.unverifiedLazy = false; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -38975,6 +40050,8 @@ object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; if (message.weak != null && message.hasOwnProperty("weak")) object.weak = message.weak; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -42263,6 +43340,209 @@ return Timestamp; })(); + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + 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]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.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.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FieldMask; + })(); + protobuf.Any = (function() { /** @@ -42866,209 +44146,6 @@ return Empty; })(); - protobuf.FieldMask = (function() { - - /** - * Properties of a FieldMask. - * @memberof google.protobuf - * @interface IFieldMask - * @property {Array.|null} [paths] FieldMask paths - */ - - /** - * Constructs a new FieldMask. - * @memberof google.protobuf - * @classdesc Represents a FieldMask. - * @implements IFieldMask - * @constructor - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - */ - function FieldMask(properties) { - this.paths = []; - 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]]; - } - - /** - * FieldMask paths. - * @member {Array.} paths - * @memberof google.protobuf.FieldMask - * @instance - */ - FieldMask.prototype.paths = $util.emptyArray; - - /** - * Creates a new FieldMask instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - * @returns {google.protobuf.FieldMask} FieldMask instance - */ - FieldMask.create = function create(properties) { - return new FieldMask(properties); - }; - - /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldMask.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.paths != null && message.paths.length) - for (var i = 0; i < message.paths.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); - return writer; - }; - - /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldMask.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldMask message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldMask - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldMask} FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldMask.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.protobuf.FieldMask(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldMask - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldMask} FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldMask.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldMask message. - * @function verify - * @memberof google.protobuf.FieldMask - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldMask.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.paths != null && message.hasOwnProperty("paths")) { - if (!Array.isArray(message.paths)) - return "paths: array expected"; - for (var i = 0; i < message.paths.length; ++i) - if (!$util.isString(message.paths[i])) - return "paths: string[] expected"; - } - return null; - }; - - /** - * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldMask - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldMask} FieldMask - */ - FieldMask.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldMask) - return object; - var message = new $root.google.protobuf.FieldMask(); - if (object.paths) { - if (!Array.isArray(object.paths)) - throw TypeError(".google.protobuf.FieldMask.paths: array expected"); - message.paths = []; - for (var i = 0; i < object.paths.length; ++i) - message.paths[i] = String(object.paths[i]); - } - return message; - }; - - /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.FieldMask} message FieldMask - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldMask.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.paths = []; - if (message.paths && message.paths.length) { - object.paths = []; - for (var j = 0; j < message.paths.length; ++j) - object.paths[j] = message.paths[j]; - } - return object; - }; - - /** - * Converts this FieldMask to JSON. - * @function toJSON - * @memberof google.protobuf.FieldMask - * @instance - * @returns {Object.} JSON object - */ - FieldMask.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return FieldMask; - })(); - protobuf.DoubleValue = (function() { /** @@ -44843,7 +45920,7 @@ }; /** - * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|setIamPolicy}. * @memberof google.iam.v1.IAMPolicy * @typedef SetIamPolicyCallback * @type {function} @@ -44876,7 +45953,7 @@ */ /** - * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|getIamPolicy}. * @memberof google.iam.v1.IAMPolicy * @typedef GetIamPolicyCallback * @type {function} @@ -44909,7 +45986,7 @@ */ /** - * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * Callback as used by {@link google.iam.v1.IAMPolicy|testIamPermissions}. * @memberof google.iam.v1.IAMPolicy * @typedef TestIamPermissionsCallback * @type {function} @@ -44952,6 +46029,7 @@ * @interface ISetIamPolicyRequest * @property {string|null} [resource] SetIamPolicyRequest resource * @property {google.iam.v1.IPolicy|null} [policy] SetIamPolicyRequest policy + * @property {google.protobuf.IFieldMask|null} [updateMask] SetIamPolicyRequest updateMask */ /** @@ -44985,6 +46063,14 @@ */ SetIamPolicyRequest.prototype.policy = null; + /** + * SetIamPolicyRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.iam.v1.SetIamPolicyRequest + * @instance + */ + SetIamPolicyRequest.prototype.updateMask = null; + /** * Creates a new SetIamPolicyRequest instance using the specified properties. * @function create @@ -45013,6 +46099,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); if (message.policy != null && Object.hasOwnProperty.call(message, "policy")) $root.google.iam.v1.Policy.encode(message.policy, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -45053,6 +46141,9 @@ case 2: message.policy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); break; + case 3: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -45096,6 +46187,11 @@ if (error) return "policy." + error; } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } return null; }; @@ -45118,6 +46214,11 @@ throw TypeError(".google.iam.v1.SetIamPolicyRequest.policy: object expected"); message.policy = $root.google.iam.v1.Policy.fromObject(object.policy); } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.iam.v1.SetIamPolicyRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } return message; }; @@ -45137,11 +46238,14 @@ if (options.defaults) { object.resource = ""; object.policy = null; + object.updateMask = null; } if (message.resource != null && message.hasOwnProperty("resource")) object.resource = message.resource; if (message.policy != null && message.hasOwnProperty("policy")) object.policy = $root.google.iam.v1.Policy.toObject(message.policy, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; @@ -45998,6 +47102,7 @@ * @interface IPolicy * @property {number|null} [version] Policy version * @property {Array.|null} [bindings] Policy bindings + * @property {Array.|null} [auditConfigs] Policy auditConfigs * @property {Uint8Array|null} [etag] Policy etag */ @@ -46011,6 +47116,7 @@ */ function Policy(properties) { this.bindings = []; + this.auditConfigs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46033,6 +47139,14 @@ */ Policy.prototype.bindings = $util.emptyArray; + /** + * Policy auditConfigs. + * @member {Array.} auditConfigs + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.auditConfigs = $util.emptyArray; + /** * Policy etag. * @member {Uint8Array} etag @@ -46072,6 +47186,9 @@ if (message.bindings != null && message.bindings.length) for (var i = 0; i < message.bindings.length; ++i) $root.google.iam.v1.Binding.encode(message.bindings[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.auditConfigs != null && message.auditConfigs.length) + for (var i = 0; i < message.auditConfigs.length; ++i) + $root.google.iam.v1.AuditConfig.encode(message.auditConfigs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -46114,6 +47231,11 @@ message.bindings = []; message.bindings.push($root.google.iam.v1.Binding.decode(reader, reader.uint32())); break; + case 6: + if (!(message.auditConfigs && message.auditConfigs.length)) + message.auditConfigs = []; + message.auditConfigs.push($root.google.iam.v1.AuditConfig.decode(reader, reader.uint32())); + break; case 3: message.etag = reader.bytes(); break; @@ -46164,6 +47286,15 @@ return "bindings." + error; } } + if (message.auditConfigs != null && message.hasOwnProperty("auditConfigs")) { + if (!Array.isArray(message.auditConfigs)) + return "auditConfigs: array expected"; + for (var i = 0; i < message.auditConfigs.length; ++i) { + var error = $root.google.iam.v1.AuditConfig.verify(message.auditConfigs[i]); + if (error) + return "auditConfigs." + error; + } + } if (message.etag != null && message.hasOwnProperty("etag")) if (!(message.etag && typeof message.etag.length === "number" || $util.isString(message.etag))) return "etag: buffer expected"; @@ -46194,6 +47325,16 @@ message.bindings[i] = $root.google.iam.v1.Binding.fromObject(object.bindings[i]); } } + if (object.auditConfigs) { + if (!Array.isArray(object.auditConfigs)) + throw TypeError(".google.iam.v1.Policy.auditConfigs: array expected"); + message.auditConfigs = []; + for (var i = 0; i < object.auditConfigs.length; ++i) { + if (typeof object.auditConfigs[i] !== "object") + throw TypeError(".google.iam.v1.Policy.auditConfigs: object expected"); + message.auditConfigs[i] = $root.google.iam.v1.AuditConfig.fromObject(object.auditConfigs[i]); + } + } if (object.etag != null) if (typeof object.etag === "string") $util.base64.decode(object.etag, message.etag = $util.newBuffer($util.base64.length(object.etag)), 0); @@ -46215,8 +47356,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.bindings = []; + object.auditConfigs = []; + } if (options.defaults) { object.version = 0; if (options.bytes === String) @@ -46236,6 +47379,11 @@ for (var j = 0; j < message.bindings.length; ++j) object.bindings[j] = $root.google.iam.v1.Binding.toObject(message.bindings[j], options); } + if (message.auditConfigs && message.auditConfigs.length) { + object.auditConfigs = []; + for (var j = 0; j < message.auditConfigs.length; ++j) + object.auditConfigs[j] = $root.google.iam.v1.AuditConfig.toObject(message.auditConfigs[j], options); + } return object; }; @@ -46507,6 +47655,504 @@ return Binding; })(); + v1.AuditConfig = (function() { + + /** + * Properties of an AuditConfig. + * @memberof google.iam.v1 + * @interface IAuditConfig + * @property {string|null} [service] AuditConfig service + * @property {Array.|null} [auditLogConfigs] AuditConfig auditLogConfigs + */ + + /** + * Constructs a new AuditConfig. + * @memberof google.iam.v1 + * @classdesc Represents an AuditConfig. + * @implements IAuditConfig + * @constructor + * @param {google.iam.v1.IAuditConfig=} [properties] Properties to set + */ + function AuditConfig(properties) { + this.auditLogConfigs = []; + 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]]; + } + + /** + * AuditConfig service. + * @member {string} service + * @memberof google.iam.v1.AuditConfig + * @instance + */ + AuditConfig.prototype.service = ""; + + /** + * AuditConfig auditLogConfigs. + * @member {Array.} auditLogConfigs + * @memberof google.iam.v1.AuditConfig + * @instance + */ + AuditConfig.prototype.auditLogConfigs = $util.emptyArray; + + /** + * Creates a new AuditConfig instance using the specified properties. + * @function create + * @memberof google.iam.v1.AuditConfig + * @static + * @param {google.iam.v1.IAuditConfig=} [properties] Properties to set + * @returns {google.iam.v1.AuditConfig} AuditConfig instance + */ + AuditConfig.create = function create(properties) { + return new AuditConfig(properties); + }; + + /** + * Encodes the specified AuditConfig message. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.AuditConfig + * @static + * @param {google.iam.v1.IAuditConfig} message AuditConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.service); + if (message.auditLogConfigs != null && message.auditLogConfigs.length) + for (var i = 0; i < message.auditLogConfigs.length; ++i) + $root.google.iam.v1.AuditLogConfig.encode(message.auditLogConfigs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AuditConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.AuditConfig + * @static + * @param {google.iam.v1.IAuditConfig} message AuditConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AuditConfig message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.AuditConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.AuditConfig} AuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditConfig.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.iam.v1.AuditConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.service = reader.string(); + break; + case 3: + if (!(message.auditLogConfigs && message.auditLogConfigs.length)) + message.auditLogConfigs = []; + message.auditLogConfigs.push($root.google.iam.v1.AuditLogConfig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AuditConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.AuditConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.AuditConfig} AuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AuditConfig message. + * @function verify + * @memberof google.iam.v1.AuditConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AuditConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.auditLogConfigs != null && message.hasOwnProperty("auditLogConfigs")) { + if (!Array.isArray(message.auditLogConfigs)) + return "auditLogConfigs: array expected"; + for (var i = 0; i < message.auditLogConfigs.length; ++i) { + var error = $root.google.iam.v1.AuditLogConfig.verify(message.auditLogConfigs[i]); + if (error) + return "auditLogConfigs." + error; + } + } + return null; + }; + + /** + * Creates an AuditConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.AuditConfig + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.AuditConfig} AuditConfig + */ + AuditConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.AuditConfig) + return object; + var message = new $root.google.iam.v1.AuditConfig(); + if (object.service != null) + message.service = String(object.service); + if (object.auditLogConfigs) { + if (!Array.isArray(object.auditLogConfigs)) + throw TypeError(".google.iam.v1.AuditConfig.auditLogConfigs: array expected"); + message.auditLogConfigs = []; + for (var i = 0; i < object.auditLogConfigs.length; ++i) { + if (typeof object.auditLogConfigs[i] !== "object") + throw TypeError(".google.iam.v1.AuditConfig.auditLogConfigs: object expected"); + message.auditLogConfigs[i] = $root.google.iam.v1.AuditLogConfig.fromObject(object.auditLogConfigs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an AuditConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.AuditConfig + * @static + * @param {google.iam.v1.AuditConfig} message AuditConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AuditConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.auditLogConfigs = []; + if (options.defaults) + object.service = ""; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.auditLogConfigs && message.auditLogConfigs.length) { + object.auditLogConfigs = []; + for (var j = 0; j < message.auditLogConfigs.length; ++j) + object.auditLogConfigs[j] = $root.google.iam.v1.AuditLogConfig.toObject(message.auditLogConfigs[j], options); + } + return object; + }; + + /** + * Converts this AuditConfig to JSON. + * @function toJSON + * @memberof google.iam.v1.AuditConfig + * @instance + * @returns {Object.} JSON object + */ + AuditConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AuditConfig; + })(); + + v1.AuditLogConfig = (function() { + + /** + * Properties of an AuditLogConfig. + * @memberof google.iam.v1 + * @interface IAuditLogConfig + * @property {google.iam.v1.AuditLogConfig.LogType|null} [logType] AuditLogConfig logType + * @property {Array.|null} [exemptedMembers] AuditLogConfig exemptedMembers + */ + + /** + * Constructs a new AuditLogConfig. + * @memberof google.iam.v1 + * @classdesc Represents an AuditLogConfig. + * @implements IAuditLogConfig + * @constructor + * @param {google.iam.v1.IAuditLogConfig=} [properties] Properties to set + */ + function AuditLogConfig(properties) { + this.exemptedMembers = []; + 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]]; + } + + /** + * AuditLogConfig logType. + * @member {google.iam.v1.AuditLogConfig.LogType} logType + * @memberof google.iam.v1.AuditLogConfig + * @instance + */ + AuditLogConfig.prototype.logType = 0; + + /** + * AuditLogConfig exemptedMembers. + * @member {Array.} exemptedMembers + * @memberof google.iam.v1.AuditLogConfig + * @instance + */ + AuditLogConfig.prototype.exemptedMembers = $util.emptyArray; + + /** + * Creates a new AuditLogConfig instance using the specified properties. + * @function create + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.IAuditLogConfig=} [properties] Properties to set + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig instance + */ + AuditLogConfig.create = function create(properties) { + return new AuditLogConfig(properties); + }; + + /** + * Encodes the specified AuditLogConfig message. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.IAuditLogConfig} message AuditLogConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditLogConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.logType != null && Object.hasOwnProperty.call(message, "logType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.logType); + if (message.exemptedMembers != null && message.exemptedMembers.length) + for (var i = 0; i < message.exemptedMembers.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.exemptedMembers[i]); + return writer; + }; + + /** + * Encodes the specified AuditLogConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.IAuditLogConfig} message AuditLogConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditLogConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditLogConfig.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.iam.v1.AuditLogConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.logType = reader.int32(); + break; + case 2: + if (!(message.exemptedMembers && message.exemptedMembers.length)) + message.exemptedMembers = []; + message.exemptedMembers.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditLogConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AuditLogConfig message. + * @function verify + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AuditLogConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.logType != null && message.hasOwnProperty("logType")) + switch (message.logType) { + default: + return "logType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.exemptedMembers != null && message.hasOwnProperty("exemptedMembers")) { + if (!Array.isArray(message.exemptedMembers)) + return "exemptedMembers: array expected"; + for (var i = 0; i < message.exemptedMembers.length; ++i) + if (!$util.isString(message.exemptedMembers[i])) + return "exemptedMembers: string[] expected"; + } + return null; + }; + + /** + * Creates an AuditLogConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig + */ + AuditLogConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.AuditLogConfig) + return object; + var message = new $root.google.iam.v1.AuditLogConfig(); + switch (object.logType) { + case "LOG_TYPE_UNSPECIFIED": + case 0: + message.logType = 0; + break; + case "ADMIN_READ": + case 1: + message.logType = 1; + break; + case "DATA_WRITE": + case 2: + message.logType = 2; + break; + case "DATA_READ": + case 3: + message.logType = 3; + break; + } + if (object.exemptedMembers) { + if (!Array.isArray(object.exemptedMembers)) + throw TypeError(".google.iam.v1.AuditLogConfig.exemptedMembers: array expected"); + message.exemptedMembers = []; + for (var i = 0; i < object.exemptedMembers.length; ++i) + message.exemptedMembers[i] = String(object.exemptedMembers[i]); + } + return message; + }; + + /** + * Creates a plain object from an AuditLogConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.AuditLogConfig} message AuditLogConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AuditLogConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.exemptedMembers = []; + if (options.defaults) + object.logType = options.enums === String ? "LOG_TYPE_UNSPECIFIED" : 0; + if (message.logType != null && message.hasOwnProperty("logType")) + object.logType = options.enums === String ? $root.google.iam.v1.AuditLogConfig.LogType[message.logType] : message.logType; + if (message.exemptedMembers && message.exemptedMembers.length) { + object.exemptedMembers = []; + for (var j = 0; j < message.exemptedMembers.length; ++j) + object.exemptedMembers[j] = message.exemptedMembers[j]; + } + return object; + }; + + /** + * Converts this AuditLogConfig to JSON. + * @function toJSON + * @memberof google.iam.v1.AuditLogConfig + * @instance + * @returns {Object.} JSON object + */ + AuditLogConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * LogType enum. + * @name google.iam.v1.AuditLogConfig.LogType + * @enum {number} + * @property {number} LOG_TYPE_UNSPECIFIED=0 LOG_TYPE_UNSPECIFIED value + * @property {number} ADMIN_READ=1 ADMIN_READ value + * @property {number} DATA_WRITE=2 DATA_WRITE value + * @property {number} DATA_READ=3 DATA_READ value + */ + AuditLogConfig.LogType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LOG_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADMIN_READ"] = 1; + values[valuesById[2] = "DATA_WRITE"] = 2; + values[valuesById[3] = "DATA_READ"] = 3; + return values; + })(); + + return AuditLogConfig; + })(); + v1.PolicyDelta = (function() { /** @@ -47654,7 +49300,7 @@ }; /** - * Callback as used by {@link google.longrunning.Operations#listOperations}. + * Callback as used by {@link google.longrunning.Operations|listOperations}. * @memberof google.longrunning.Operations * @typedef ListOperationsCallback * @type {function} @@ -47687,7 +49333,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#getOperation}. + * Callback as used by {@link google.longrunning.Operations|getOperation}. * @memberof google.longrunning.Operations * @typedef GetOperationCallback * @type {function} @@ -47720,7 +49366,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. * @memberof google.longrunning.Operations * @typedef DeleteOperationCallback * @type {function} @@ -47753,7 +49399,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. * @memberof google.longrunning.Operations * @typedef CancelOperationCallback * @type {function} @@ -47786,7 +49432,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * Callback as used by {@link google.longrunning.Operations|waitOperation}. * @memberof google.longrunning.Operations * @typedef WaitOperationCallback * @type {function} diff --git a/protos/protos.json b/protos/protos.json index 2d250f758..5d444ffb4 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -963,6 +963,13 @@ "(google.api.resource).type": "bigtableadmin.googleapis.com/Instance", "(google.api.resource).pattern": "projects/{project}/instances/{instance}" }, + "oneofs": { + "_satisfiesPzs": { + "oneof": [ + "satisfiesPzs" + ] + } + }, "fields": { "name": { "type": "string", @@ -977,16 +984,25 @@ }, "state": { "type": "State", - "id": 3 + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, "type": { "type": "Type", - "id": 4 + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "labels": { "keyType": "string", "type": "string", - "id": 5 + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "createTime": { "type": "google.protobuf.Timestamp", @@ -994,6 +1010,14 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "satisfiesPzs": { + "type": "bool", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } } }, "nested": { @@ -1018,6 +1042,10 @@ "cpuUtilizationPercent": { "type": "int32", "id": 2 + }, + "storageUtilizationGibPerNode": { + "type": "int32", + "id": 3 } } }, @@ -1381,6 +1409,34 @@ } ] }, + "UndeleteTable": { + "requestType": "UndeleteTableRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/instances/*/tables/*}:undelete", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "Table", + "(google.longrunning.operation_info).metadata_type": "UndeleteTableMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/instances/*/tables/*}:undelete", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Table", + "metadata_type": "UndeleteTableMetadata" + } + } + ] + }, "ModifyColumnFamilies": { "requestType": "ModifyColumnFamiliesRequest", "responseType": "Table", @@ -1665,6 +1721,34 @@ } ] }, + "CopyBackup": { + "requestType": "CopyBackupRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/instances/*/clusters/*}/backups:copy", + "(google.api.http).body": "*", + "(google.api.method_signature)": "parent,backup_id,source_backup,expire_time", + "(google.longrunning.operation_info).response_type": "Backup", + "(google.longrunning.operation_info).metadata_type": "CopyBackupMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/instances/*/clusters/*}/backups:copy", + "body": "*" + } + }, + { + "(google.api.method_signature)": "parent,backup_id,source_backup,expire_time" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Backup", + "metadata_type": "CopyBackupMetadata" + } + } + ] + }, "GetIamPolicy": { "requestType": "google.iam.v1.GetIamPolicyRequest", "responseType": "google.iam.v1.Policy", @@ -1982,6 +2066,34 @@ } } }, + "UndeleteTableRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "bigtableadmin.googleapis.com/Table" + } + } + } + }, + "UndeleteTableMetadata": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, "ModifyColumnFamiliesRequest": { "fields": { "name": { @@ -2333,6 +2445,62 @@ } } }, + "CopyBackupRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "bigtableadmin.googleapis.com/Cluster" + } + }, + "backupId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sourceBackup": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "bigtableadmin.googleapis.com/Backup" + } + }, + "expireTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CopyBackupMetadata": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "bigtableadmin.googleapis.com/Backup" + } + }, + "sourceBackup": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "bigtableadmin.googleapis.com/Backup" + } + }, + "progress": { + "type": "OperationProgress", + "id": 3 + } + } + }, "RestoreInfo": { "oneofs": { "sourceInfo": { @@ -2545,15 +2713,24 @@ }, "sourceTable": { "type": "Table", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, "dataSizeBytes": { "type": "int64", - "id": 3 + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, "createTime": { "type": "google.protobuf.Timestamp", - "id": 4 + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, "deleteTime": { "type": "google.protobuf.Timestamp", @@ -2561,7 +2738,10 @@ }, "state": { "type": "State", - "id": 6 + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, "description": { "type": "string", @@ -4586,6 +4766,13 @@ "default": false } }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "options": { + "default": false + } + }, "deprecated": { "type": "bool", "id": 3, @@ -4895,6 +5082,15 @@ } } }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, "Any": { "fields": { "type_url": { @@ -4922,15 +5118,6 @@ "Empty": { "fields": {} }, - "FieldMask": { - "fields": { - "paths": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } - }, "DoubleValue": { "fields": { "value": { @@ -5089,6 +5276,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 } } }, @@ -5156,6 +5347,11 @@ "type": "Binding", "id": 4 }, + "auditConfigs": { + "rule": "repeated", + "type": "AuditConfig", + "id": 6 + }, "etag": { "type": "bytes", "id": 3 @@ -5179,6 +5375,42 @@ } } }, + "AuditConfig": { + "fields": { + "service": { + "type": "string", + "id": 1 + }, + "auditLogConfigs": { + "rule": "repeated", + "type": "AuditLogConfig", + "id": 3 + } + } + }, + "AuditLogConfig": { + "fields": { + "logType": { + "type": "LogType", + "id": 1 + }, + "exemptedMembers": { + "rule": "repeated", + "type": "string", + "id": 2 + } + }, + "nested": { + "LogType": { + "values": { + "LOG_TYPE_UNSPECIFIED": 0, + "ADMIN_READ": 1, + "DATA_WRITE": 2, + "DATA_READ": 3 + } + } + } + }, "PolicyDelta": { "fields": { "bindingDeltas": { diff --git a/src/v2/bigtable_instance_admin_client.ts b/src/v2/bigtable_instance_admin_client.ts index a044acc2f..63306282c 100644 --- a/src/v2/bigtable_instance_admin_client.ts +++ b/src/v2/bigtable_instance_admin_client.ts @@ -18,18 +18,10 @@ /* global window */ import * as gax from 'google-gax'; -import { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LROperation, - PaginationCallback, - GaxCall, -} from 'google-gax'; - -import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; +import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -38,7 +30,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './bigtable_instance_admin_client_config.json'; -import {operationsProtos} from 'google-gax'; +import { operationsProtos } from 'google-gax'; const version = require('../../../package.json').version; /** @@ -65,6 +57,7 @@ export class BigtableInstanceAdminClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; bigtableInstanceAdminStub?: Promise<{[name: string]: Function}>; @@ -74,7 +67,7 @@ export class BigtableInstanceAdminClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -97,26 +90,19 @@ export class BigtableInstanceAdminClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. - const staticMembers = this - .constructor as typeof BigtableInstanceAdminClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); + const staticMembers = this.constructor as typeof BigtableInstanceAdminClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -134,7 +120,7 @@ export class BigtableInstanceAdminClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -146,9 +132,14 @@ export class BigtableInstanceAdminClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -156,7 +147,7 @@ export class BigtableInstanceAdminClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else if (opts.fallback === 'rest' ) { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -199,109 +190,81 @@ export class BigtableInstanceAdminClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listAppProfiles: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'appProfiles' - ), - listHotTablets: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'hotTablets' - ), + listAppProfiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'appProfiles'), + listHotTablets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hotTablets') }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - - this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) - .operationsClient(opts); + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=operations/**}:cancel',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v2/{name=operations/**}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=operations/**}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=operations/projects/**}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); const createInstanceResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Instance' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.Instance') as gax.protobuf.Type; const createInstanceMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.CreateInstanceMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.CreateInstanceMetadata') as gax.protobuf.Type; const partialUpdateInstanceResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Instance' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.Instance') as gax.protobuf.Type; const partialUpdateInstanceMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.UpdateInstanceMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.UpdateInstanceMetadata') as gax.protobuf.Type; const createClusterResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Cluster' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.Cluster') as gax.protobuf.Type; const createClusterMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.CreateClusterMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.CreateClusterMetadata') as gax.protobuf.Type; const updateClusterResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Cluster' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.Cluster') as gax.protobuf.Type; const updateClusterMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.UpdateClusterMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.UpdateClusterMetadata') as gax.protobuf.Type; const partialUpdateClusterResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Cluster' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.Cluster') as gax.protobuf.Type; const partialUpdateClusterMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.PartialUpdateClusterMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.PartialUpdateClusterMetadata') as gax.protobuf.Type; const updateAppProfileResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.AppProfile' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.AppProfile') as gax.protobuf.Type; const updateAppProfileMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.UpdateAppProfileMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.UpdateAppProfileMetadata') as gax.protobuf.Type; this.descriptors.longrunning = { createInstance: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata) - ), + createInstanceMetadata.decode.bind(createInstanceMetadata)), partialUpdateInstance: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - partialUpdateInstanceResponse.decode.bind( - partialUpdateInstanceResponse - ), - partialUpdateInstanceMetadata.decode.bind(partialUpdateInstanceMetadata) - ), + partialUpdateInstanceResponse.decode.bind(partialUpdateInstanceResponse), + partialUpdateInstanceMetadata.decode.bind(partialUpdateInstanceMetadata)), createCluster: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createClusterResponse.decode.bind(createClusterResponse), - createClusterMetadata.decode.bind(createClusterMetadata) - ), + createClusterMetadata.decode.bind(createClusterMetadata)), updateCluster: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateClusterResponse.decode.bind(updateClusterResponse), - updateClusterMetadata.decode.bind(updateClusterMetadata) - ), + updateClusterMetadata.decode.bind(updateClusterMetadata)), partialUpdateCluster: new this._gaxModule.LongrunningDescriptor( this.operationsClient, partialUpdateClusterResponse.decode.bind(partialUpdateClusterResponse), - partialUpdateClusterMetadata.decode.bind(partialUpdateClusterMetadata) - ), + partialUpdateClusterMetadata.decode.bind(partialUpdateClusterMetadata)), updateAppProfile: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateAppProfileResponse.decode.bind(updateAppProfileResponse), - updateAppProfileMetadata.decode.bind(updateAppProfileMetadata) - ), + updateAppProfileMetadata.decode.bind(updateAppProfileMetadata)) }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.bigtable.admin.v2.BigtableInstanceAdmin', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} - ); + 'google.bigtable.admin.v2.BigtableInstanceAdmin', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -332,55 +295,28 @@ export class BigtableInstanceAdminClient { // Put together the "service stub" for // google.bigtable.admin.v2.BigtableInstanceAdmin. this.bigtableInstanceAdminStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.bigtable.admin.v2.BigtableInstanceAdmin' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.bigtable.admin.v2.BigtableInstanceAdmin') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.bigtable.admin.v2.BigtableInstanceAdmin, - this._opts, - this._providedCustomServicePath - ) as Promise<{[method: string]: Function}>; + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const bigtableInstanceAdminStubMethods = [ - 'createInstance', - 'getInstance', - 'listInstances', - 'updateInstance', - 'partialUpdateInstance', - 'deleteInstance', - 'createCluster', - 'getCluster', - 'listClusters', - 'updateCluster', - 'partialUpdateCluster', - 'deleteCluster', - 'createAppProfile', - 'getAppProfile', - 'listAppProfiles', - 'updateAppProfile', - 'deleteAppProfile', - 'getIamPolicy', - 'setIamPolicy', - 'testIamPermissions', - 'listHotTablets', - ]; + const bigtableInstanceAdminStubMethods = + ['createInstance', 'getInstance', 'listInstances', 'updateInstance', 'partialUpdateInstance', 'deleteInstance', 'createCluster', 'getCluster', 'listClusters', 'updateCluster', 'partialUpdateCluster', 'deleteCluster', 'createAppProfile', 'getAppProfile', 'listAppProfiles', 'updateAppProfile', 'deleteAppProfile', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions', 'listHotTablets']; for (const methodName of bigtableInstanceAdminStubMethods) { const callPromise = this.bigtableInstanceAdminStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { throw err; - } - ); + }); const descriptor = this.descriptors.page[methodName] || @@ -436,7 +372,7 @@ export class BigtableInstanceAdminClient { 'https://www.googleapis.com/auth/cloud-bigtable.admin', 'https://www.googleapis.com/auth/cloud-bigtable.admin.cluster', 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only', + 'https://www.googleapis.com/auth/cloud-platform.read-only' ]; } @@ -446,9 +382,8 @@ export class BigtableInstanceAdminClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId( - callback?: Callback - ): Promise | void { + getProjectId(callback?: Callback): + Promise|void { if (callback) { this.auth.getProjectId(callback); return; @@ -459,2252 +394,1769 @@ export class BigtableInstanceAdminClient { // ------------------- // -- Service calls -- // ------------------- - /** - * Gets information about an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested instance. Values are of the form - * `projects/{project}/instances/{instance}`. - * @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 [Instance]{@link google.bigtable.admin.v2.Instance}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.get_instance.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async - */ +/** + * Gets information about an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested instance. Values are of the form + * `projects/{project}/instances/{instance}`. + * @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 [Instance]{@link google.bigtable.admin.v2.Instance}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.get_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async + */ getInstance( - request?: protos.google.bigtable.admin.v2.IGetInstanceRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IGetInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|undefined, {}|undefined + ]>; getInstance( - request: protos.google.bigtable.admin.v2.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; getInstance( - request: protos.google.bigtable.admin.v2.IGetInstanceRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetInstanceRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; getInstance( - request?: protos.google.bigtable.admin.v2.IGetInstanceRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IGetInstanceRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.IInstance, - | protos.google.bigtable.admin.v2.IGetInstanceRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.getInstance(request, options, callback); } - /** - * Lists information about instances in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the project for which a list of instances is requested. - * Values are of the form `projects/{project}`. - * @param {string} request.pageToken - * DEPRECATED: This field is unused and ignored. - * @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 [ListInstancesResponse]{@link google.bigtable.admin.v2.ListInstancesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.list_instances.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async - */ +/** + * Lists information about instances in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the project for which a list of instances is requested. + * Values are of the form `projects/{project}`. + * @param {string} request.pageToken + * DEPRECATED: This field is unused and ignored. + * @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 [ListInstancesResponse]{@link google.bigtable.admin.v2.ListInstancesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.list_instances.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async + */ listInstances( - request?: protos.google.bigtable.admin.v2.IListInstancesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IListInstancesRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|undefined, {}|undefined + ]>; listInstances( - request: protos.google.bigtable.admin.v2.IListInstancesRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IListInstancesRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, + {}|null|undefined>): void; listInstances( - request: protos.google.bigtable.admin.v2.IListInstancesRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IListInstancesRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, + {}|null|undefined>): void; listInstances( - request?: protos.google.bigtable.admin.v2.IListInstancesRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IListInstancesRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.IListInstancesResponse, - | protos.google.bigtable.admin.v2.IListInstancesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.listInstances(request, options, callback); } - /** - * Updates an instance within a project. This method updates only the display - * name and type for an Instance. To update other Instance properties, such as - * labels, use PartialUpdateInstance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The unique name of the instance. Values are of the form - * `projects/{project}/instances/{@link a-z0-9\\-|a-z}+[a-z0-9]`. - * @param {string} request.displayName - * Required. The descriptive name for this instance as it appears in UIs. - * Can be changed at any time, but should be kept globally unique - * to avoid confusion. - * @param {google.bigtable.admin.v2.Instance.State} request.state - * (`OutputOnly`) - * The current state of the instance. - * @param {google.bigtable.admin.v2.Instance.Type} request.type - * The type of the instance. Defaults to `PRODUCTION`. - * @param {number[]} request.labels - * Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. They can be used to filter resources and aggregate - * metrics. - * - * * Label keys must be between 1 and 63 characters long and must conform to - * the regular expression: `{@link \p{Ll}\p{Lo}\p{N}_-|\p{Ll}\p{Lo}}{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform to - * the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * * Keys and values must both be under 128 bytes. - * @param {google.protobuf.Timestamp} request.createTime - * Output only. A server-assigned timestamp representing when this Instance was created. - * For instances created before this field was added (August 2021), this value - * is `seconds: 0, nanos: 1`. - * @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 [Instance]{@link google.bigtable.admin.v2.Instance}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.update_instance.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async - */ +/** + * Updates an instance within a project. This method updates only the display + * name and type for an Instance. To update other Instance properties, such as + * labels, use PartialUpdateInstance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The unique name of the instance. Values are of the form + * `projects/{project}/instances/{@link a-z0-9\\-|a-z}+[a-z0-9]`. + * @param {string} request.displayName + * Required. The descriptive name for this instance as it appears in UIs. + * Can be changed at any time, but should be kept globally unique + * to avoid confusion. + * @param {google.bigtable.admin.v2.Instance.State} request.state + * Output only. The current state of the instance. + * @param {google.bigtable.admin.v2.Instance.Type} request.type + * Required. The type of the instance. Defaults to `PRODUCTION`. + * @param {number[]} request.labels + * Required. Labels are a flexible and lightweight mechanism for organizing + * cloud resources into groups that reflect a customer's organizational needs + * and deployment strategies. They can be used to filter resources and + * aggregate metrics. + * + * * Label keys must be between 1 and 63 characters long and must conform to + * the regular expression: `{@link \p{Ll}\p{Lo}\p{N}_-|\p{Ll}\p{Lo}}{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform to + * the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * * Keys and values must both be under 128 bytes. + * @param {google.protobuf.Timestamp} request.createTime + * Output only. A server-assigned timestamp representing when this Instance + * was created. For instances created before this field was added (August + * 2021), this value is `seconds: 0, nanos: 1`. + * @param {boolean} request.satisfiesPzs + * Output only. Reserved for future use. + * @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 [Instance]{@link google.bigtable.admin.v2.Instance}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async + */ updateInstance( - request?: protos.google.bigtable.admin.v2.IInstance, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IInstance, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|undefined, {}|undefined + ]>; updateInstance( - request: protos.google.bigtable.admin.v2.IInstance, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IInstance, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|null|undefined, + {}|null|undefined>): void; updateInstance( - request: protos.google.bigtable.admin.v2.IInstance, - callback: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IInstance, + callback: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|null|undefined, + {}|null|undefined>): void; updateInstance( - request?: protos.google.bigtable.admin.v2.IInstance, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IInstance, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IInstance|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.updateInstance(request, options, callback); } - /** - * Delete an instance from a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the instance to be deleted. - * Values are of the form `projects/{project}/instances/{instance}`. - * @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 [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.delete_instance.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async - */ +/** + * Delete an instance from a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the instance to be deleted. + * Values are of the form `projects/{project}/instances/{instance}`. + * @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 [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.delete_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async + */ deleteInstance( - request?: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|undefined, {}|undefined + ]>; deleteInstance( - request: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, + {}|null|undefined>): void; deleteInstance( - request: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, + {}|null|undefined>): void; deleteInstance( - request?: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDeleteInstanceRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteInstance(request, options, callback); } - /** - * Gets information about a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested cluster. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @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 [Cluster]{@link google.bigtable.admin.v2.Cluster}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.get_cluster.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async - */ +/** + * Gets information about a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested cluster. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @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 [Cluster]{@link google.bigtable.admin.v2.Cluster}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.get_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async + */ getCluster( - request?: protos.google.bigtable.admin.v2.IGetClusterRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IGetClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|undefined, {}|undefined + ]>; getCluster( - request: protos.google.bigtable.admin.v2.IGetClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; getCluster( - request: protos.google.bigtable.admin.v2.IGetClusterRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetClusterRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; getCluster( - request?: protos.google.bigtable.admin.v2.IGetClusterRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IGetClusterRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.getCluster(request, options, callback); } - /** - * Lists information about clusters in an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which a list of clusters is requested. - * Values are of the form `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list Clusters for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - * @param {string} request.pageToken - * DEPRECATED: This field is unused and ignored. - * @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 [ListClustersResponse]{@link google.bigtable.admin.v2.ListClustersResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.list_clusters.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async - */ +/** + * Lists information about clusters in an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which a list of clusters is requested. + * Values are of the form `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list Clusters for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + * @param {string} request.pageToken + * DEPRECATED: This field is unused and ignored. + * @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 [ListClustersResponse]{@link google.bigtable.admin.v2.ListClustersResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.list_clusters.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async + */ listClusters( - request?: protos.google.bigtable.admin.v2.IListClustersRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IListClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|undefined, {}|undefined + ]>; listClusters( - request: protos.google.bigtable.admin.v2.IListClustersRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IListClustersRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, + {}|null|undefined>): void; listClusters( - request: protos.google.bigtable.admin.v2.IListClustersRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IListClustersRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, + {}|null|undefined>): void; listClusters( - request?: protos.google.bigtable.admin.v2.IListClustersRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IListClustersRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.IListClustersResponse, - | protos.google.bigtable.admin.v2.IListClustersRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.listClusters(request, options, callback); } - /** - * Deletes a cluster from an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the cluster to be deleted. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @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 [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.delete_cluster.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async - */ +/** + * Deletes a cluster from an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the cluster to be deleted. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @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 [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.delete_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async + */ deleteCluster( - request?: protos.google.bigtable.admin.v2.IDeleteClusterRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IDeleteClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|undefined, {}|undefined + ]>; deleteCluster( - request: protos.google.bigtable.admin.v2.IDeleteClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): void; deleteCluster( - request: protos.google.bigtable.admin.v2.IDeleteClusterRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteClusterRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): void; deleteCluster( - request?: protos.google.bigtable.admin.v2.IDeleteClusterRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IDeleteClusterRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDeleteClusterRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteCluster(request, options, callback); } - /** - * Creates an app profile within an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance in which to create the new app profile. - * Values are of the form - * `projects/{project}/instances/{instance}`. - * @param {string} request.appProfileId - * Required. The ID to be used when referring to the new app profile within its - * instance, e.g., just `myprofile` rather than - * `projects/myproject/instances/myinstance/appProfiles/myprofile`. - * @param {google.bigtable.admin.v2.AppProfile} request.appProfile - * Required. The app profile to be created. - * Fields marked `OutputOnly` will be ignored. - * @param {boolean} request.ignoreWarnings - * If true, ignore safety checks when creating the app profile. - * @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 [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.create_app_profile.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async - */ +/** + * Creates an app profile within an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance in which to create the new app profile. + * Values are of the form + * `projects/{project}/instances/{instance}`. + * @param {string} request.appProfileId + * Required. The ID to be used when referring to the new app profile within its + * instance, e.g., just `myprofile` rather than + * `projects/myproject/instances/myinstance/appProfiles/myprofile`. + * @param {google.bigtable.admin.v2.AppProfile} request.appProfile + * Required. The app profile to be created. + * Fields marked `OutputOnly` will be ignored. + * @param {boolean} request.ignoreWarnings + * If true, ignore safety checks when creating the app profile. + * @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 [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async + */ createAppProfile( - request?: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.ICreateAppProfileRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|undefined, {}|undefined + ]>; createAppProfile( - request: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - | protos.google.bigtable.admin.v2.ICreateAppProfileRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, + {}|null|undefined>): void; createAppProfile( - request: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - | protos.google.bigtable.admin.v2.ICreateAppProfileRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, + {}|null|undefined>): void; createAppProfile( - request?: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.IAppProfile, - | protos.google.bigtable.admin.v2.ICreateAppProfileRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - | protos.google.bigtable.admin.v2.ICreateAppProfileRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.ICreateAppProfileRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.createAppProfile(request, options, callback); } - /** - * Gets information about an app profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested app profile. Values are of the form - * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. - * @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 [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.get_app_profile.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async - */ +/** + * Gets information about an app profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested app profile. Values are of the form + * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. + * @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 [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.get_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async + */ getAppProfile( - request?: protos.google.bigtable.admin.v2.IGetAppProfileRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IGetAppProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|undefined, {}|undefined + ]>; getAppProfile( - request: protos.google.bigtable.admin.v2.IGetAppProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetAppProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, + {}|null|undefined>): void; getAppProfile( - request: protos.google.bigtable.admin.v2.IGetAppProfileRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetAppProfileRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, + {}|null|undefined>): void; getAppProfile( - request?: protos.google.bigtable.admin.v2.IGetAppProfileRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IGetAppProfileRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.IAppProfile, - | protos.google.bigtable.admin.v2.IGetAppProfileRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.getAppProfile(request, options, callback); } - /** - * Deletes an app profile from an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the app profile to be deleted. Values are of the form - * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. - * @param {boolean} request.ignoreWarnings - * Required. If true, ignore safety checks when deleting the app profile. - * @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 [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.delete_app_profile.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async - */ +/** + * Deletes an app profile from an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the app profile to be deleted. Values are of the form + * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. + * @param {boolean} request.ignoreWarnings + * Required. If true, ignore safety checks when deleting the app profile. + * @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 [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.delete_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async + */ deleteAppProfile( - request?: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteAppProfileRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|undefined, {}|undefined + ]>; deleteAppProfile( - request: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDeleteAppProfileRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, + {}|null|undefined>): void; deleteAppProfile( - request: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDeleteAppProfileRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, + {}|null|undefined>): void; deleteAppProfile( - request?: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDeleteAppProfileRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDeleteAppProfileRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteAppProfileRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteAppProfile(request, options, callback); } - /** - * Gets the access control policy for an instance resource. Returns an empty - * policy if an instance exists but does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @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 [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.get_iam_policy.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async - */ +/** + * Gets the access control policy for an instance resource. Returns an empty + * policy if an instance exists but does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * @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 [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.get_iam_policy.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async + */ getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | undefined, - {} | undefined - ] - > | void { + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); } - /** - * Sets the access control policy on an instance resource. Replaces any - * existing policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @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 [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.set_iam_policy.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async - */ +/** + * Sets the access control policy on an instance resource. Replaces any + * existing policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @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 [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.set_iam_policy.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async + */ setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | undefined, - {} | undefined - ] - > | void { + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); } - /** - * Returns permissions that the caller has on the specified instance resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async - */ +/** + * Returns permissions that the caller has on the specified instance resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async + */ testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | undefined, - {} | undefined - ] - > | void { + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); } - /** - * Create an instance within a project. - * - * Note that exactly one of Cluster.serve_nodes and - * Cluster.cluster_config.cluster_autoscaling_config can be set. If - * serve_nodes is set to non-zero, then the cluster is manually scaled. If - * cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is - * enabled. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the project in which to create the new instance. - * Values are of the form `projects/{project}`. - * @param {string} request.instanceId - * Required. The ID to be used when referring to the new instance within its project, - * e.g., just `myinstance` rather than - * `projects/myproject/instances/myinstance`. - * @param {google.bigtable.admin.v2.Instance} request.instance - * Required. The instance to create. - * Fields marked `OutputOnly` must be left blank. - * @param {number[]} request.clusters - * Required. The clusters to be created within the instance, mapped by desired - * cluster ID, e.g., just `mycluster` rather than - * `projects/myproject/instances/myinstance/clusters/mycluster`. - * Fields marked `OutputOnly` must be left blank. - * Currently, at most four clusters can be specified. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.create_instance.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async - */ +/** + * Create an instance within a project. + * + * Note that exactly one of Cluster.serve_nodes and + * Cluster.cluster_config.cluster_autoscaling_config can be set. If + * serve_nodes is set to non-zero, then the cluster is manually scaled. If + * cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is + * enabled. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the project in which to create the new instance. + * Values are of the form `projects/{project}`. + * @param {string} request.instanceId + * Required. The ID to be used when referring to the new instance within its project, + * e.g., just `myinstance` rather than + * `projects/myproject/instances/myinstance`. + * @param {google.bigtable.admin.v2.Instance} request.instance + * Required. The instance to create. + * Fields marked `OutputOnly` must be left blank. + * @param {number[]} request.clusters + * Required. The clusters to be created within the instance, mapped by desired + * cluster ID, e.g., just `mycluster` rather than + * `projects/myproject/instances/myinstance/clusters/mycluster`. + * Fields marked `OutputOnly` must be left blank. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async + */ createInstance( - request?: protos.google.bigtable.admin.v2.ICreateInstanceRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.ICreateInstanceMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.ICreateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; createInstance( - request: protos.google.bigtable.admin.v2.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.ICreateInstanceMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createInstance( - request: protos.google.bigtable.admin.v2.ICreateInstanceRequest, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.ICreateInstanceMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createInstance( - request?: protos.google.bigtable.admin.v2.ICreateInstanceRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.ICreateInstanceMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.ICreateInstanceMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.ICreateInstanceMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.ICreateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.createInstance(request, options, callback); } - /** - * Check the status of the long running operation returned by `createInstance()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.create_instance.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async - */ - async checkCreateInstanceProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.Instance, - protos.google.bigtable.admin.v2.CreateInstanceMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `createInstance()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async + */ + async checkCreateInstanceProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.createInstance, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.Instance, - protos.google.bigtable.admin.v2.CreateInstanceMetadata - >; + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Partially updates an instance within a project. This method can modify all - * fields of an Instance and is the preferred way to update an Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.bigtable.admin.v2.Instance} request.instance - * Required. The Instance which will (partially) replace the current value. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The subset of Instance fields which should be replaced. - * Must be explicitly set. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_instance.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async - */ +/** + * Partially updates an instance within a project. This method can modify all + * fields of an Instance and is the preferred way to update an Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.bigtable.admin.v2.Instance} request.instance + * Required. The Instance which will (partially) replace the current value. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The subset of Instance fields which should be replaced. + * Must be explicitly set. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async + */ partialUpdateInstance( - request?: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IUpdateInstanceMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; partialUpdateInstance( - request: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IUpdateInstanceMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; partialUpdateInstance( - request: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IUpdateInstanceMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; partialUpdateInstance( - request?: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IUpdateInstanceMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IUpdateInstanceMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IUpdateInstanceMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - 'instance.name': request.instance!.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'instance.name': request.instance!.name || '', + }); this.initialize(); return this.innerApiCalls.partialUpdateInstance(request, options, callback); } - /** - * Check the status of the long running operation returned by `partialUpdateInstance()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_instance.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async - */ - async checkPartialUpdateInstanceProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.Instance, - protos.google.bigtable.admin.v2.UpdateInstanceMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `partialUpdateInstance()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async + */ + async checkPartialUpdateInstanceProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.partialUpdateInstance, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.Instance, - protos.google.bigtable.admin.v2.UpdateInstanceMetadata - >; + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.partialUpdateInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Creates a cluster within an instance. - * - * Note that exactly one of Cluster.serve_nodes and - * Cluster.cluster_config.cluster_autoscaling_config can be set. If - * serve_nodes is set to non-zero, then the cluster is manually scaled. If - * cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is - * enabled. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance in which to create the new cluster. - * Values are of the form - * `projects/{project}/instances/{instance}`. - * @param {string} request.clusterId - * Required. The ID to be used when referring to the new cluster within its instance, - * e.g., just `mycluster` rather than - * `projects/myproject/instances/myinstance/clusters/mycluster`. - * @param {google.bigtable.admin.v2.Cluster} request.cluster - * Required. The cluster to be created. - * Fields marked `OutputOnly` must be left blank. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.create_cluster.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async - */ +/** + * Creates a cluster within an instance. + * + * Note that exactly one of Cluster.serve_nodes and + * Cluster.cluster_config.cluster_autoscaling_config can be set. If + * serve_nodes is set to non-zero, then the cluster is manually scaled. If + * cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is + * enabled. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance in which to create the new cluster. + * Values are of the form + * `projects/{project}/instances/{instance}`. + * @param {string} request.clusterId + * Required. The ID to be used when referring to the new cluster within its instance, + * e.g., just `mycluster` rather than + * `projects/myproject/instances/myinstance/clusters/mycluster`. + * @param {google.bigtable.admin.v2.Cluster} request.cluster + * Required. The cluster to be created. + * Fields marked `OutputOnly` must be left blank. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async + */ createCluster( - request?: protos.google.bigtable.admin.v2.ICreateClusterRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.ICreateClusterMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.ICreateClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; createCluster( - request: protos.google.bigtable.admin.v2.ICreateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.ICreateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createCluster( - request: protos.google.bigtable.admin.v2.ICreateClusterRequest, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.ICreateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createCluster( - request?: protos.google.bigtable.admin.v2.ICreateClusterRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.ICreateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.ICreateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.ICreateClusterMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.ICreateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.createCluster(request, options, callback); } - /** - * Check the status of the long running operation returned by `createCluster()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.create_cluster.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async - */ - async checkCreateClusterProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.Cluster, - protos.google.bigtable.admin.v2.CreateClusterMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `createCluster()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async + */ + async checkCreateClusterProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.createCluster, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.Cluster, - protos.google.bigtable.admin.v2.CreateClusterMetadata - >; + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCluster, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Updates a cluster within an instance. - * - * Note that UpdateCluster does not support updating - * cluster_config.cluster_autoscaling_config. In order to update it, you - * must use PartialUpdateCluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The unique name of the cluster. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{@link -a-z0-9|a-z}*`. - * @param {string} request.location - * Immutable. The location where this cluster's nodes and storage reside. For best - * performance, clients should be located as close as possible to this - * cluster. Currently only zones are supported, so values should be of the - * form `projects/{project}/locations/{zone}`. - * @param {google.bigtable.admin.v2.Cluster.State} request.state - * Output only. The current state of the cluster. - * @param {number} request.serveNodes - * The number of nodes allocated to this cluster. More nodes enable higher - * throughput and more consistent performance. - * @param {google.bigtable.admin.v2.Cluster.ClusterConfig} request.clusterConfig - * Configuration for this cluster. - * @param {google.bigtable.admin.v2.StorageType} request.defaultStorageType - * Immutable. The type of storage used by this cluster to serve its - * parent instance's tables, unless explicitly overridden. - * @param {google.bigtable.admin.v2.Cluster.EncryptionConfig} request.encryptionConfig - * Immutable. The encryption configuration for CMEK-protected clusters. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.update_cluster.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async - */ +/** + * Updates a cluster within an instance. + * + * Note that UpdateCluster does not support updating + * cluster_config.cluster_autoscaling_config. In order to update it, you + * must use PartialUpdateCluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The unique name of the cluster. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{@link -a-z0-9|a-z}*`. + * @param {string} request.location + * Immutable. The location where this cluster's nodes and storage reside. For + * best performance, clients should be located as close as possible to this + * cluster. Currently only zones are supported, so values should be of the + * form `projects/{project}/locations/{zone}`. + * @param {google.bigtable.admin.v2.Cluster.State} request.state + * Output only. The current state of the cluster. + * @param {number} request.serveNodes + * The number of nodes allocated to this cluster. More nodes enable higher + * throughput and more consistent performance. + * @param {google.bigtable.admin.v2.Cluster.ClusterConfig} request.clusterConfig + * Configuration for this cluster. + * @param {google.bigtable.admin.v2.StorageType} request.defaultStorageType + * Immutable. The type of storage used by this cluster to serve its + * parent instance's tables, unless explicitly overridden. + * @param {google.bigtable.admin.v2.Cluster.EncryptionConfig} request.encryptionConfig + * Immutable. The encryption configuration for CMEK-protected clusters. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async + */ updateCluster( - request?: protos.google.bigtable.admin.v2.ICluster, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.ICluster, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; updateCluster( - request: protos.google.bigtable.admin.v2.ICluster, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICluster, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; updateCluster( - request: protos.google.bigtable.admin.v2.ICluster, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICluster, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; updateCluster( - request?: protos.google.bigtable.admin.v2.ICluster, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.ICluster, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.updateCluster(request, options, callback); } - /** - * Check the status of the long running operation returned by `updateCluster()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.update_cluster.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async - */ - async checkUpdateClusterProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.Cluster, - protos.google.bigtable.admin.v2.UpdateClusterMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `updateCluster()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async + */ + async checkUpdateClusterProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.updateCluster, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.Cluster, - protos.google.bigtable.admin.v2.UpdateClusterMetadata - >; + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCluster, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Partially updates a cluster within a project. This method is the preferred - * way to update a Cluster. - * - * To enable and update autoscaling, set - * cluster_config.cluster_autoscaling_config. When autoscaling is enabled, - * serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it - * are ignored. Note that an update cannot simultaneously set serve_nodes to - * non-zero and cluster_config.cluster_autoscaling_config to non-empty, and - * also specify both in the update_mask. - * - * To disable autoscaling, clear cluster_config.cluster_autoscaling_config, - * and explicitly set a serve_node count via the update_mask. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.bigtable.admin.v2.Cluster} request.cluster - * Required. The Cluster which contains the partial updates to be applied, subject to - * the update_mask. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The subset of Cluster fields which should be replaced. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async - */ +/** + * Partially updates a cluster within a project. This method is the preferred + * way to update a Cluster. + * + * To enable and update autoscaling, set + * cluster_config.cluster_autoscaling_config. When autoscaling is enabled, + * serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it + * are ignored. Note that an update cannot simultaneously set serve_nodes to + * non-zero and cluster_config.cluster_autoscaling_config to non-empty, and + * also specify both in the update_mask. + * + * To disable autoscaling, clear cluster_config.cluster_autoscaling_config, + * and explicitly set a serve_node count via the update_mask. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.bigtable.admin.v2.Cluster} request.cluster + * Required. The Cluster which contains the partial updates to be applied, subject to + * the update_mask. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The subset of Cluster fields which should be replaced. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async + */ partialUpdateCluster( - request?: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IPartialUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; partialUpdateCluster( - request: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IPartialUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; partialUpdateCluster( - request: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IPartialUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; partialUpdateCluster( - request?: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IPartialUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IPartialUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IPartialUpdateClusterMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - 'cluster.name': request.cluster!.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'cluster.name': request.cluster!.name || '', + }); this.initialize(); return this.innerApiCalls.partialUpdateCluster(request, options, callback); } - /** - * Check the status of the long running operation returned by `partialUpdateCluster()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async - */ - async checkPartialUpdateClusterProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.Cluster, - protos.google.bigtable.admin.v2.PartialUpdateClusterMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `partialUpdateCluster()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async + */ + async checkPartialUpdateClusterProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.partialUpdateCluster, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.Cluster, - protos.google.bigtable.admin.v2.PartialUpdateClusterMetadata - >; + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.partialUpdateCluster, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Updates an app profile within an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.bigtable.admin.v2.AppProfile} request.appProfile - * Required. The app profile which will (partially) replace the current value. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The subset of app profile fields which should be replaced. - * If unset, all fields will be replaced. - * @param {boolean} request.ignoreWarnings - * If true, ignore safety checks when updating the app profile. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.update_app_profile.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async - */ +/** + * Updates an app profile within an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.bigtable.admin.v2.AppProfile} request.appProfile + * Required. The app profile which will (partially) replace the current value. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The subset of app profile fields which should be replaced. + * If unset, all fields will be replaced. + * @param {boolean} request.ignoreWarnings + * If true, ignore safety checks when updating the app profile. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async + */ updateAppProfile( - request?: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IUpdateAppProfileMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; updateAppProfile( - request: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IUpdateAppProfileMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; updateAppProfile( - request: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IUpdateAppProfileMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; updateAppProfile( - request?: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IUpdateAppProfileMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IUpdateAppProfileMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IUpdateAppProfileMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - 'app_profile.name': request.appProfile!.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'app_profile.name': request.appProfile!.name || '', + }); this.initialize(); return this.innerApiCalls.updateAppProfile(request, options, callback); } - /** - * Check the status of the long running operation returned by `updateAppProfile()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.update_app_profile.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async - */ - async checkUpdateAppProfileProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.AppProfile, - protos.google.bigtable.admin.v2.UpdateAppProfileMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `updateAppProfile()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async + */ + async checkUpdateAppProfileProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.updateAppProfile, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.AppProfile, - protos.google.bigtable.admin.v2.UpdateAppProfileMetadata - >; - } - /** - * Lists information about app profiles in an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which a list of app profiles is - * requested. Values are of the form - * `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @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 Array of [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAppProfilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateAppProfile, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists information about app profiles in an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which a list of app profiles is + * requested. Values are of the form + * `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @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 Array of [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAppProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listAppProfiles( - request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IAppProfile[], - protos.google.bigtable.admin.v2.IListAppProfilesRequest | null, - protos.google.bigtable.admin.v2.IListAppProfilesResponse - ] - >; + request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile[], + protos.google.bigtable.admin.v2.IListAppProfilesRequest|null, + protos.google.bigtable.admin.v2.IListAppProfilesResponse + ]>; listAppProfiles( - request: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListAppProfilesRequest, - | protos.google.bigtable.admin.v2.IListAppProfilesResponse - | null - | undefined, - protos.google.bigtable.admin.v2.IAppProfile - > - ): void; + request: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListAppProfilesRequest, + protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, + protos.google.bigtable.admin.v2.IAppProfile>): void; listAppProfiles( - request: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListAppProfilesRequest, - | protos.google.bigtable.admin.v2.IListAppProfilesResponse - | null - | undefined, - protos.google.bigtable.admin.v2.IAppProfile - > - ): void; + request: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListAppProfilesRequest, + protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, + protos.google.bigtable.admin.v2.IAppProfile>): void; listAppProfiles( - request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< + request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< protos.google.bigtable.admin.v2.IListAppProfilesRequest, - | protos.google.bigtable.admin.v2.IListAppProfilesResponse - | null - | undefined, - protos.google.bigtable.admin.v2.IAppProfile - >, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListAppProfilesRequest, - | protos.google.bigtable.admin.v2.IListAppProfilesResponse - | null - | undefined, - protos.google.bigtable.admin.v2.IAppProfile - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IAppProfile[], - protos.google.bigtable.admin.v2.IListAppProfilesRequest | null, - protos.google.bigtable.admin.v2.IListAppProfilesResponse - ] - > | void { + protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, + protos.google.bigtable.admin.v2.IAppProfile>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListAppProfilesRequest, + protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, + protos.google.bigtable.admin.v2.IAppProfile>): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile[], + protos.google.bigtable.admin.v2.IListAppProfilesRequest|null, + protos.google.bigtable.admin.v2.IListAppProfilesResponse + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.listAppProfiles(request, options, callback); } - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which a list of app profiles is - * requested. Values are of the form - * `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [AppProfile]{@link google.bigtable.admin.v2.AppProfile} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAppProfilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which a list of app profiles is + * requested. Values are of the form + * `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [AppProfile]{@link google.bigtable.admin.v2.AppProfile} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAppProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listAppProfilesStream( - request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - options?: CallOptions - ): Transform { + request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + options?: CallOptions): + Transform{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); const defaultCallSettings = this._defaults['listAppProfiles']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -2715,55 +2167,56 @@ export class BigtableInstanceAdminClient { ); } - /** - * Equivalent to `listAppProfiles`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which a list of app profiles is - * requested. Values are of the form - * `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.list_app_profiles.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async - */ +/** + * Equivalent to `listAppProfiles`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which a list of app profiles is + * requested. Values are of the form + * `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.list_app_profiles.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async + */ listAppProfilesAsync( - request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - options?: CallOptions - ): AsyncIterable { + request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + options?: CallOptions): + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); const defaultCallSettings = this._defaults['listAppProfiles']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -2773,178 +2226,161 @@ export class BigtableInstanceAdminClient { callSettings ) as AsyncIterable; } - /** - * Lists hot tablets in a cluster, within the time range provided. Hot - * tablets are ordered based on CPU usage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The cluster name to list hot tablets. - * Value is in the following form: - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {google.protobuf.Timestamp} request.startTime - * The start time to list hot tablets. The hot tablets in the response will - * have start times between the requested start time and end time. Start time - * defaults to Now if it is unset, and end time defaults to Now - 24 hours if - * it is unset. The start time should be less than the end time, and the - * maximum allowed time range between start time and end time is 48 hours. - * Start time and end time should have values between Now and Now - 14 days. - * @param {google.protobuf.Timestamp} request.endTime - * The end time to list hot tablets. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size that is empty or zero lets the server choose the number of - * items to return. A page_size which is strictly positive will return at most - * that many items. A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls do not need a - * page_size field. If a page_size is set in subsequent calls, it must match - * the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @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 Array of [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listHotTabletsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ + /** + * Lists hot tablets in a cluster, within the time range provided. Hot + * tablets are ordered based on CPU usage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @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 Array of [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listHotTabletsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listHotTablets( - request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IHotTablet[], - protos.google.bigtable.admin.v2.IListHotTabletsRequest | null, - protos.google.bigtable.admin.v2.IListHotTabletsResponse - ] - >; + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IHotTablet[], + protos.google.bigtable.admin.v2.IListHotTabletsRequest|null, + protos.google.bigtable.admin.v2.IListHotTabletsResponse + ]>; listHotTablets( - request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListHotTabletsRequest, - | protos.google.bigtable.admin.v2.IListHotTabletsResponse - | null - | undefined, - protos.google.bigtable.admin.v2.IHotTablet - > - ): void; + request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, + protos.google.bigtable.admin.v2.IHotTablet>): void; listHotTablets( - request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListHotTabletsRequest, - | protos.google.bigtable.admin.v2.IListHotTabletsResponse - | null - | undefined, - protos.google.bigtable.admin.v2.IHotTablet - > - ): void; + request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, + protos.google.bigtable.admin.v2.IHotTablet>): void; listHotTablets( - request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< protos.google.bigtable.admin.v2.IListHotTabletsRequest, - | protos.google.bigtable.admin.v2.IListHotTabletsResponse - | null - | undefined, - protos.google.bigtable.admin.v2.IHotTablet - >, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListHotTabletsRequest, - | protos.google.bigtable.admin.v2.IListHotTabletsResponse - | null - | undefined, - protos.google.bigtable.admin.v2.IHotTablet - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IHotTablet[], - protos.google.bigtable.admin.v2.IListHotTabletsRequest | null, - protos.google.bigtable.admin.v2.IListHotTabletsResponse - ] - > | void { + protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, + protos.google.bigtable.admin.v2.IHotTablet>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, + protos.google.bigtable.admin.v2.IHotTablet>): + Promise<[ + protos.google.bigtable.admin.v2.IHotTablet[], + protos.google.bigtable.admin.v2.IListHotTabletsRequest|null, + protos.google.bigtable.admin.v2.IListHotTabletsResponse + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.listHotTablets(request, options, callback); } - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The cluster name to list hot tablets. - * Value is in the following form: - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {google.protobuf.Timestamp} request.startTime - * The start time to list hot tablets. The hot tablets in the response will - * have start times between the requested start time and end time. Start time - * defaults to Now if it is unset, and end time defaults to Now - 24 hours if - * it is unset. The start time should be less than the end time, and the - * maximum allowed time range between start time and end time is 48 hours. - * Start time and end time should have values between Now and Now - 14 days. - * @param {google.protobuf.Timestamp} request.endTime - * The end time to list hot tablets. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size that is empty or zero lets the server choose the number of - * items to return. A page_size which is strictly positive will return at most - * that many items. A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls do not need a - * page_size field. If a page_size is set in subsequent calls, it must match - * the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [HotTablet]{@link google.bigtable.admin.v2.HotTablet} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listHotTabletsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [HotTablet]{@link google.bigtable.admin.v2.HotTablet} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listHotTabletsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listHotTabletsStream( - request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - options?: CallOptions - ): Transform { + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions): + Transform{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); const defaultCallSettings = this._defaults['listHotTablets']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -2955,71 +2391,329 @@ export class BigtableInstanceAdminClient { ); } - /** - * Equivalent to `listHotTablets`, but returns an iterable object. +/** + * Equivalent to `listHotTablets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async + */ + listHotTabletsAsync( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listHotTablets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHotTablets.asyncIterate( + this.innerApiCalls['listHotTablets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. - * @param {string} request.parent - * Required. The cluster name to list hot tablets. - * Value is in the following form: - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {google.protobuf.Timestamp} request.startTime - * The start time to list hot tablets. The hot tablets in the response will - * have start times between the requested start time and end time. Start time - * defaults to Now if it is unset, and end time defaults to Now - 24 hours if - * it is unset. The start time should be less than the end time, and the - * maximum allowed time range between start time and end time is 48 hours. - * Start time and end time should have values between Now and Now - 14 days. - * @param {google.protobuf.Timestamp} request.endTime - * The end time to list hot tablets. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size that is empty or zero lets the server choose the number of - * items to return. A page_size which is strictly positive will return at most - * that many items. A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls do not need a - * page_size field. If a page_size is set in subsequent calls, it must match - * the page_size given in the first request. + * The standard list page size. * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. + * The standard list page token. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). * When you iterate the returned iterable, each element will be an object representing - * [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. The API will be called under the hood as needed, once per the page, + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, * so you can stop the iteration when you don't need more results. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example include:samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async - */ - listHotTabletsAsync( - request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - const defaultCallSettings = this._defaults['listHotTablets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHotTablets.asyncIterate( - this.innerApiCalls['listHotTablets'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); } + // -------------------- // -- Path templates -- // -------------------- @@ -3032,7 +2726,7 @@ export class BigtableInstanceAdminClient { * @param {string} app_profile * @returns {string} Resource name string. */ - appProfilePath(project: string, instance: string, appProfile: string) { + appProfilePath(project:string,instance:string,appProfile:string) { return this.pathTemplates.appProfilePathTemplate.render({ project: project, instance: instance, @@ -3048,8 +2742,7 @@ export class BigtableInstanceAdminClient { * @returns {string} A string representing the project. */ matchProjectFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName) - .project; + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).project; } /** @@ -3060,8 +2753,7 @@ export class BigtableInstanceAdminClient { * @returns {string} A string representing the instance. */ matchInstanceFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName) - .instance; + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).instance; } /** @@ -3072,8 +2764,7 @@ export class BigtableInstanceAdminClient { * @returns {string} A string representing the app_profile. */ matchAppProfileFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName) - .app_profile; + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).app_profile; } /** @@ -3085,12 +2776,7 @@ export class BigtableInstanceAdminClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath( - project: string, - instance: string, - cluster: string, - backup: string - ) { + backupPath(project:string,instance:string,cluster:string,backup:string) { return this.pathTemplates.backupPathTemplate.render({ project: project, instance: instance, @@ -3151,7 +2837,7 @@ export class BigtableInstanceAdminClient { * @param {string} cluster * @returns {string} Resource name string. */ - clusterPath(project: string, instance: string, cluster: string) { + clusterPath(project:string,instance:string,cluster:string) { return this.pathTemplates.clusterPathTemplate.render({ project: project, instance: instance, @@ -3201,12 +2887,7 @@ export class BigtableInstanceAdminClient { * @param {string} hot_tablet * @returns {string} Resource name string. */ - hotTabletPath( - project: string, - instance: string, - cluster: string, - hotTablet: string - ) { + hotTabletPath(project:string,instance:string,cluster:string,hotTablet:string) { return this.pathTemplates.hotTabletPathTemplate.render({ project: project, instance: instance, @@ -3223,8 +2904,7 @@ export class BigtableInstanceAdminClient { * @returns {string} A string representing the project. */ matchProjectFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) - .project; + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).project; } /** @@ -3235,8 +2915,7 @@ export class BigtableInstanceAdminClient { * @returns {string} A string representing the instance. */ matchInstanceFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) - .instance; + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).instance; } /** @@ -3247,8 +2926,7 @@ export class BigtableInstanceAdminClient { * @returns {string} A string representing the cluster. */ matchClusterFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) - .cluster; + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).cluster; } /** @@ -3259,8 +2937,7 @@ export class BigtableInstanceAdminClient { * @returns {string} A string representing the hot_tablet. */ matchHotTabletFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) - .hot_tablet; + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).hot_tablet; } /** @@ -3270,7 +2947,7 @@ export class BigtableInstanceAdminClient { * @param {string} instance * @returns {string} Resource name string. */ - instancePath(project: string, instance: string) { + instancePath(project:string,instance:string) { return this.pathTemplates.instancePathTemplate.render({ project: project, instance: instance, @@ -3305,7 +2982,7 @@ export class BigtableInstanceAdminClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project: string) { + projectPath(project:string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -3331,12 +3008,7 @@ export class BigtableInstanceAdminClient { * @param {string} snapshot * @returns {string} Resource name string. */ - snapshotPath( - project: string, - instance: string, - cluster: string, - snapshot: string - ) { + snapshotPath(project:string,instance:string,cluster:string,snapshot:string) { return this.pathTemplates.snapshotPathTemplate.render({ project: project, instance: instance, @@ -3397,7 +3069,7 @@ export class BigtableInstanceAdminClient { * @param {string} table * @returns {string} Resource name string. */ - tablePath(project: string, instance: string, table: string) { + tablePath(project:string,instance:string,table:string) { return this.pathTemplates.tablePathTemplate.render({ project: project, instance: instance, @@ -3449,6 +3121,7 @@ export class BigtableInstanceAdminClient { return this.bigtableInstanceAdminStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/src/v2/bigtable_table_admin_client.ts b/src/v2/bigtable_table_admin_client.ts index 67488a2f7..8b1b843dd 100644 --- a/src/v2/bigtable_table_admin_client.ts +++ b/src/v2/bigtable_table_admin_client.ts @@ -18,18 +18,10 @@ /* global window */ import * as gax from 'google-gax'; -import { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LROperation, - PaginationCallback, - GaxCall, -} from 'google-gax'; - -import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; +import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -38,7 +30,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './bigtable_table_admin_client_config.json'; -import {operationsProtos} from 'google-gax'; +import { operationsProtos } from 'google-gax'; const version = require('../../../package.json').version; /** @@ -67,6 +59,7 @@ export class BigtableTableAdminClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; bigtableTableAdminStub?: Promise<{[name: string]: Function}>; @@ -76,7 +69,7 @@ export class BigtableTableAdminClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -99,25 +92,19 @@ export class BigtableTableAdminClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof BigtableTableAdminClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -135,7 +122,7 @@ export class BigtableTableAdminClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -147,9 +134,14 @@ export class BigtableTableAdminClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -157,7 +149,7 @@ export class BigtableTableAdminClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { + } else if (opts.fallback === 'rest' ) { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { @@ -197,94 +189,83 @@ export class BigtableTableAdminClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listTables: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'tables' - ), - listSnapshots: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'snapshots' - ), - listBackups: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'backups' - ), + listTables: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tables'), + listSnapshots: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'snapshots'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - - this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) - .operationsClient(opts); + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=operations/**}:cancel',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v2/{name=operations/**}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=operations/**}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=operations/projects/**}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); const createTableFromSnapshotResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Table' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.Table') as gax.protobuf.Type; const createTableFromSnapshotMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata') as gax.protobuf.Type; + const undeleteTableResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Table') as gax.protobuf.Type; + const undeleteTableMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.UndeleteTableMetadata') as gax.protobuf.Type; const snapshotTableResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Snapshot' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.Snapshot') as gax.protobuf.Type; const snapshotTableMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.SnapshotTableMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.SnapshotTableMetadata') as gax.protobuf.Type; const createBackupResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Backup' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.Backup') as gax.protobuf.Type; const createBackupMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.CreateBackupMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.CreateBackupMetadata') as gax.protobuf.Type; const restoreTableResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Table' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.Table') as gax.protobuf.Type; const restoreTableMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.RestoreTableMetadata' - ) as gax.protobuf.Type; + '.google.bigtable.admin.v2.RestoreTableMetadata') as gax.protobuf.Type; + const copyBackupResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Backup') as gax.protobuf.Type; + const copyBackupMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.CopyBackupMetadata') as gax.protobuf.Type; this.descriptors.longrunning = { createTableFromSnapshot: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createTableFromSnapshotResponse.decode.bind( - createTableFromSnapshotResponse - ), - createTableFromSnapshotMetadata.decode.bind( - createTableFromSnapshotMetadata - ) - ), + createTableFromSnapshotResponse.decode.bind(createTableFromSnapshotResponse), + createTableFromSnapshotMetadata.decode.bind(createTableFromSnapshotMetadata)), + undeleteTable: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + undeleteTableResponse.decode.bind(undeleteTableResponse), + undeleteTableMetadata.decode.bind(undeleteTableMetadata)), snapshotTable: new this._gaxModule.LongrunningDescriptor( this.operationsClient, snapshotTableResponse.decode.bind(snapshotTableResponse), - snapshotTableMetadata.decode.bind(snapshotTableMetadata) - ), + snapshotTableMetadata.decode.bind(snapshotTableMetadata)), createBackup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata) - ), + createBackupMetadata.decode.bind(createBackupMetadata)), restoreTable: new this._gaxModule.LongrunningDescriptor( this.operationsClient, restoreTableResponse.decode.bind(restoreTableResponse), - restoreTableMetadata.decode.bind(restoreTableMetadata) - ), + restoreTableMetadata.decode.bind(restoreTableMetadata)), + copyBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + copyBackupResponse.decode.bind(copyBackupResponse), + copyBackupMetadata.decode.bind(copyBackupMetadata)) }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.bigtable.admin.v2.BigtableTableAdmin', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} - ); + 'google.bigtable.admin.v2.BigtableTableAdmin', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -315,56 +296,28 @@ export class BigtableTableAdminClient { // Put together the "service stub" for // google.bigtable.admin.v2.BigtableTableAdmin. this.bigtableTableAdminStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.bigtable.admin.v2.BigtableTableAdmin' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.bigtable.admin.v2.BigtableTableAdmin') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.bigtable.admin.v2.BigtableTableAdmin, - this._opts, - this._providedCustomServicePath - ) as Promise<{[method: string]: Function}>; + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const bigtableTableAdminStubMethods = [ - 'createTable', - 'createTableFromSnapshot', - 'listTables', - 'getTable', - 'deleteTable', - 'modifyColumnFamilies', - 'dropRowRange', - 'generateConsistencyToken', - 'checkConsistency', - 'snapshotTable', - 'getSnapshot', - 'listSnapshots', - 'deleteSnapshot', - 'createBackup', - 'getBackup', - 'updateBackup', - 'deleteBackup', - 'listBackups', - 'restoreTable', - 'getIamPolicy', - 'setIamPolicy', - 'testIamPermissions', - ]; + const bigtableTableAdminStubMethods = + ['createTable', 'createTableFromSnapshot', 'listTables', 'getTable', 'deleteTable', 'undeleteTable', 'modifyColumnFamilies', 'dropRowRange', 'generateConsistencyToken', 'checkConsistency', 'snapshotTable', 'getSnapshot', 'listSnapshots', 'deleteSnapshot', 'createBackup', 'getBackup', 'updateBackup', 'deleteBackup', 'listBackups', 'restoreTable', 'copyBackup', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions']; for (const methodName of bigtableTableAdminStubMethods) { const callPromise = this.bigtableTableAdminStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { throw err; - } - ); + }); const descriptor = this.descriptors.page[methodName] || @@ -419,7 +372,7 @@ export class BigtableTableAdminClient { 'https://www.googleapis.com/auth/cloud-bigtable.admin', 'https://www.googleapis.com/auth/cloud-bigtable.admin.table', 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only', + 'https://www.googleapis.com/auth/cloud-platform.read-only' ]; } @@ -429,9 +382,8 @@ export class BigtableTableAdminClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId( - callback?: Callback - ): Promise | void { + getProjectId(callback?: Callback): + Promise|void { if (callback) { this.auth.getProjectId(callback); return; @@ -442,2255 +394,2034 @@ export class BigtableTableAdminClient { // ------------------- // -- Service calls -- // ------------------- - /** - * Creates a new table in the specified instance. - * The table can be created with a full set of initial column families, - * specified in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance in which to create the table. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {string} request.tableId - * Required. The name by which the new table should be referred to within the parent - * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. - * Maximum 50 characters. - * @param {google.bigtable.admin.v2.Table} request.table - * Required. The Table to create. - * @param {number[]} request.initialSplits - * The optional list of row keys that will be used to initially split the - * table into several tablets (tablets are similar to HBase regions). - * Given two split keys, `s1` and `s2`, three tablets will be created, - * spanning the key ranges: `[, s1), [s1, s2), [s2, )`. - * - * Example: - * - * * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` - * `"other", "zz"]` - * * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` - * * Key assignment: - * - Tablet 1 `[, apple) => {"a"}.` - * - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` - * - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` - * - Tablet 4 `[customer_2, other) => {"customer_2"}.` - * - Tablet 5 `[other, ) => {"other", "zz"}.` - * @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 [Table]{@link google.bigtable.admin.v2.Table}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.create_table.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async - */ +/** + * Creates a new table in the specified instance. + * The table can be created with a full set of initial column families, + * specified in the request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance in which to create the table. + * Values are of the form `projects/{project}/instances/{instance}`. + * @param {string} request.tableId + * Required. The name by which the new table should be referred to within the + * parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + * Maximum 50 characters. + * @param {google.bigtable.admin.v2.Table} request.table + * Required. The Table to create. + * @param {number[]} request.initialSplits + * The optional list of row keys that will be used to initially split the + * table into several tablets (tablets are similar to HBase regions). + * Given two split keys, `s1` and `s2`, three tablets will be created, + * spanning the key ranges: `[, s1), [s1, s2), [s2, )`. + * + * Example: + * + * * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` + * `"other", "zz"]` + * * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` + * * Key assignment: + * - Tablet 1 `[, apple) => {"a"}.` + * - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` + * - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` + * - Tablet 4 `[customer_2, other) => {"customer_2"}.` + * - Tablet 5 `[other, ) => {"other", "zz"}.` + * @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 [Table]{@link google.bigtable.admin.v2.Table}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async + */ createTable( - request?: protos.google.bigtable.admin.v2.ICreateTableRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.ICreateTableRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|undefined, {}|undefined + ]>; createTable( - request: protos.google.bigtable.admin.v2.ICreateTableRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateTableRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, + {}|null|undefined>): void; createTable( - request: protos.google.bigtable.admin.v2.ICreateTableRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateTableRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, + {}|null|undefined>): void; createTable( - request?: protos.google.bigtable.admin.v2.ICreateTableRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.ICreateTableRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.ITable, - | protos.google.bigtable.admin.v2.ICreateTableRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.createTable(request, options, callback); } - /** - * Gets metadata information about the specified table. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested table. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {google.bigtable.admin.v2.Table.View} request.view - * The view to be applied to the returned table's fields. - * Defaults to `SCHEMA_VIEW` if unspecified. - * @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 [Table]{@link google.bigtable.admin.v2.Table}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.get_table.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async - */ +/** + * Gets metadata information about the specified table. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested table. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {google.bigtable.admin.v2.Table.View} request.view + * The view to be applied to the returned table's fields. + * Defaults to `SCHEMA_VIEW` if unspecified. + * @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 [Table]{@link google.bigtable.admin.v2.Table}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.get_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async + */ getTable( - request?: protos.google.bigtable.admin.v2.IGetTableRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IGetTableRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|undefined, {}|undefined + ]>; getTable( - request: protos.google.bigtable.admin.v2.IGetTableRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetTableRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, + {}|null|undefined>): void; getTable( - request: protos.google.bigtable.admin.v2.IGetTableRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetTableRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, + {}|null|undefined>): void; getTable( - request?: protos.google.bigtable.admin.v2.IGetTableRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IGetTableRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.getTable(request, options, callback); } - /** - * Permanently deletes a specified table and all of its data. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the table to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @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 [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.delete_table.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async - */ +/** + * Permanently deletes a specified table and all of its data. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the table to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @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 [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.delete_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async + */ deleteTable( - request?: protos.google.bigtable.admin.v2.IDeleteTableRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IDeleteTableRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|undefined, {}|undefined + ]>; deleteTable( - request: protos.google.bigtable.admin.v2.IDeleteTableRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteTableRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, + {}|null|undefined>): void; deleteTable( - request: protos.google.bigtable.admin.v2.IDeleteTableRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteTableRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, + {}|null|undefined>): void; deleteTable( - request?: protos.google.bigtable.admin.v2.IDeleteTableRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IDeleteTableRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDeleteTableRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteTable(request, options, callback); } - /** - * Performs a series of column family modifications on the specified table. - * Either all or none of the modifications will occur before this method - * returns, but data requests received prior to that point may see a table - * where only some modifications have taken effect. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the table whose families should be modified. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {number[]} request.modifications - * Required. Modifications to be atomically applied to the specified table's families. - * Entries are applied in order, meaning that earlier modifications can be - * masked by later ones (in the case of repeated updates to the same family, - * for example). - * @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 [Table]{@link google.bigtable.admin.v2.Table}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.modify_column_families.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async - */ +/** + * Performs a series of column family modifications on the specified table. + * Either all or none of the modifications will occur before this method + * returns, but data requests received prior to that point may see a table + * where only some modifications have taken effect. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the table whose families should be modified. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {number[]} request.modifications + * Required. Modifications to be atomically applied to the specified table's + * families. Entries are applied in order, meaning that earlier modifications + * can be masked by later ones (in the case of repeated updates to the same + * family, for example). + * @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 [Table]{@link google.bigtable.admin.v2.Table}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.modify_column_families.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async + */ modifyColumnFamilies( - request?: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|undefined, {}|undefined + ]>; modifyColumnFamilies( - request: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - | protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, + {}|null|undefined>): void; modifyColumnFamilies( - request: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - | protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, + {}|null|undefined>): void; modifyColumnFamilies( - request?: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.ITable, - | protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.ITable, - | protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.modifyColumnFamilies(request, options, callback); } - /** - * Permanently drop/delete a row range from a specified table. The request can - * specify whether to delete all rows in a table, or only those that match a - * particular prefix. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the table on which to drop a range of rows. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {Buffer} request.rowKeyPrefix - * Delete all rows that start with this row key prefix. Prefix cannot be - * zero length. - * @param {boolean} request.deleteAllDataFromTable - * Delete all rows in the table. Setting this to false is a no-op. - * @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 [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.drop_row_range.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async - */ +/** + * Permanently drop/delete a row range from a specified table. The request can + * specify whether to delete all rows in a table, or only those that match a + * particular prefix. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the table on which to drop a range of rows. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {Buffer} request.rowKeyPrefix + * Delete all rows that start with this row key prefix. Prefix cannot be + * zero length. + * @param {boolean} request.deleteAllDataFromTable + * Delete all rows in the table. Setting this to false is a no-op. + * @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 [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.drop_row_range.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async + */ dropRowRange( - request?: protos.google.bigtable.admin.v2.IDropRowRangeRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IDropRowRangeRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|undefined, {}|undefined + ]>; dropRowRange( - request: protos.google.bigtable.admin.v2.IDropRowRangeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDropRowRangeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, + {}|null|undefined>): void; dropRowRange( - request: protos.google.bigtable.admin.v2.IDropRowRangeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDropRowRangeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, + {}|null|undefined>): void; dropRowRange( - request?: protos.google.bigtable.admin.v2.IDropRowRangeRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IDropRowRangeRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDropRowRangeRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.dropRowRange(request, options, callback); } - /** - * Generates a consistency token for a Table, which can be used in - * CheckConsistency to check whether mutations to the table that finished - * before this call started have been replicated. The tokens will be available - * for 90 days. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the Table for which to create a consistency token. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @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 [GenerateConsistencyTokenResponse]{@link google.bigtable.admin.v2.GenerateConsistencyTokenResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.generate_consistency_token.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async - */ +/** + * Generates a consistency token for a Table, which can be used in + * CheckConsistency to check whether mutations to the table that finished + * before this call started have been replicated. The tokens will be available + * for 90 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the Table for which to create a consistency + * token. Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @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 [GenerateConsistencyTokenResponse]{@link google.bigtable.admin.v2.GenerateConsistencyTokenResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.generate_consistency_token.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async + */ generateConsistencyToken( - request?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - ( - | protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest - | undefined - ), - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|undefined, {}|undefined + ]>; generateConsistencyToken( - request: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - | protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, + {}|null|undefined>): void; generateConsistencyToken( - request: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - | protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, + {}|null|undefined>): void; generateConsistencyToken( - request?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - | protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - | protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - ( - | protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest - | undefined - ), - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); - return this.innerApiCalls.generateConsistencyToken( - request, - options, - callback - ); + return this.innerApiCalls.generateConsistencyToken(request, options, callback); } - /** - * Checks replication consistency based on a consistency token, that is, if - * replication has caught up based on the conditions specified in the token - * and the check request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the Table for which to check replication consistency. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {string} request.consistencyToken - * Required. The token created using GenerateConsistencyToken for the Table. - * @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 [CheckConsistencyResponse]{@link google.bigtable.admin.v2.CheckConsistencyResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.check_consistency.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async - */ +/** + * Checks replication consistency based on a consistency token, that is, if + * replication has caught up based on the conditions specified in the token + * and the check request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the Table for which to check replication + * consistency. Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {string} request.consistencyToken + * Required. The token created using GenerateConsistencyToken for the Table. + * @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 [CheckConsistencyResponse]{@link google.bigtable.admin.v2.CheckConsistencyResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.check_consistency.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async + */ checkConsistency( - request?: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - protos.google.bigtable.admin.v2.ICheckConsistencyRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|undefined, {}|undefined + ]>; checkConsistency( - request: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - | protos.google.bigtable.admin.v2.ICheckConsistencyRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, + {}|null|undefined>): void; checkConsistency( - request: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - | protos.google.bigtable.admin.v2.ICheckConsistencyRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, + {}|null|undefined>): void; checkConsistency( - request?: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - | protos.google.bigtable.admin.v2.ICheckConsistencyRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - | protos.google.bigtable.admin.v2.ICheckConsistencyRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - protos.google.bigtable.admin.v2.ICheckConsistencyRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.checkConsistency(request, options, callback); } - /** - * Gets metadata information about the specified snapshot. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested snapshot. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - * @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 [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.get_snapshot.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async - */ +/** + * Gets metadata information about the specified snapshot. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested snapshot. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + * @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 [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.get_snapshot.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async + */ getSnapshot( - request?: protos.google.bigtable.admin.v2.IGetSnapshotRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IGetSnapshotRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|undefined, {}|undefined + ]>; getSnapshot( - request: protos.google.bigtable.admin.v2.IGetSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetSnapshotRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, + {}|null|undefined>): void; getSnapshot( - request: protos.google.bigtable.admin.v2.IGetSnapshotRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetSnapshotRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, + {}|null|undefined>): void; getSnapshot( - request?: protos.google.bigtable.admin.v2.IGetSnapshotRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IGetSnapshotRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.ISnapshot, - | protos.google.bigtable.admin.v2.IGetSnapshotRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.getSnapshot(request, options, callback); } - /** - * Permanently deletes the specified snapshot. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the snapshot to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - * @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 [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.delete_snapshot.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async - */ +/** + * Permanently deletes the specified snapshot. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the snapshot to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + * @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 [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.delete_snapshot.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async + */ deleteSnapshot( - request?: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|undefined, {}|undefined + ]>; deleteSnapshot( - request: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>): void; deleteSnapshot( - request: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>): void; deleteSnapshot( - request?: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDeleteSnapshotRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteSnapshot(request, options, callback); } - /** - * Gets metadata on a pending or completed Cloud Bigtable Backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the backup. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. - * @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 [Backup]{@link google.bigtable.admin.v2.Backup}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.get_backup.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async - */ +/** + * Gets metadata on a pending or completed Cloud Bigtable Backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the backup. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + * @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 [Backup]{@link google.bigtable.admin.v2.Backup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.get_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async + */ getBackup( - request?: protos.google.bigtable.admin.v2.IGetBackupRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|undefined, {}|undefined + ]>; getBackup( - request: protos.google.bigtable.admin.v2.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; getBackup( - request: protos.google.bigtable.admin.v2.IGetBackupRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IGetBackupRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; getBackup( - request?: protos.google.bigtable.admin.v2.IGetBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.getBackup(request, options, callback); } - /** - * Updates a pending or completed Cloud Bigtable Backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.bigtable.admin.v2.Backup} request.backup - * Required. The backup to update. `backup.name`, and the fields to be updated - * as specified by `update_mask` are required. Other fields are ignored. - * Update is only supported for the following fields: - * * `backup.expire_time`. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A mask specifying which fields (e.g. `expire_time`) in the - * Backup resource should be updated. This mask is relative to the Backup - * resource, not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased accidentally - * by clients that do not know about them. - * @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 [Backup]{@link google.bigtable.admin.v2.Backup}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.update_backup.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async - */ +/** + * Updates a pending or completed Cloud Bigtable Backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.bigtable.admin.v2.Backup} request.backup + * Required. The backup to update. `backup.name`, and the fields to be updated + * as specified by `update_mask` are required. Other fields are ignored. + * Update is only supported for the following fields: + * * `backup.expire_time`. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A mask specifying which fields (e.g. `expire_time`) in the + * Backup resource should be updated. This mask is relative to the Backup + * resource, not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased accidentally + * by clients that do not know about them. + * @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 [Backup]{@link google.bigtable.admin.v2.Backup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.update_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async + */ updateBackup( - request?: protos.google.bigtable.admin.v2.IUpdateBackupRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IUpdateBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|undefined, {}|undefined + ]>; updateBackup( - request: protos.google.bigtable.admin.v2.IUpdateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IUpdateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, + {}|null|undefined>): void; updateBackup( - request: protos.google.bigtable.admin.v2.IUpdateBackupRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IUpdateBackupRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, + {}|null|undefined>): void; updateBackup( - request?: protos.google.bigtable.admin.v2.IUpdateBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IUpdateBackupRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.bigtable.admin.v2.IBackup, - | protos.google.bigtable.admin.v2.IUpdateBackupRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - 'backup.name': request.backup!.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'backup.name': request.backup!.name || '', + }); this.initialize(); return this.innerApiCalls.updateBackup(request, options, callback); } - /** - * Deletes a pending or completed Cloud Bigtable backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the backup to delete. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. - * @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 [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.delete_backup.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async - */ +/** + * Deletes a pending or completed Cloud Bigtable backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the backup to delete. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + * @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 [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.delete_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async + */ deleteBackup( - request?: protos.google.bigtable.admin.v2.IDeleteBackupRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|undefined, {}|undefined + ]>; deleteBackup( - request: protos.google.bigtable.admin.v2.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, + {}|null|undefined>): void; deleteBackup( - request: protos.google.bigtable.admin.v2.IDeleteBackupRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IDeleteBackupRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, + {}|null|undefined>): void; deleteBackup( - request?: protos.google.bigtable.admin.v2.IDeleteBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.bigtable.admin.v2.IDeleteBackupRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.protobuf.IEmpty, - | protos.google.bigtable.admin.v2.IDeleteBackupRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest | undefined, - {} | undefined - ] - > | void { + protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteBackup(request, options, callback); } - /** - * Gets the access control policy for a Table or Backup resource. - * Returns an empty policy if the resource exists but does not have a policy - * set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @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 [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.get_iam_policy.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async - */ +/** + * Gets the access control policy for a Table resource. + * Returns an empty policy if the resource exists but does not have a policy + * set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * @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 [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.get_iam_policy.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async + */ getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | undefined, - {} | undefined - ] - > | void { + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); } - /** - * Sets the access control policy on a Table or Backup resource. - * Replaces any existing policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @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 [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.set_iam_policy.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async - */ +/** + * Sets the access control policy on a Table resource. + * Replaces any existing policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @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 [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.set_iam_policy.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async + */ setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | undefined, - {} | undefined - ] - > | void { + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); } - /** - * Returns permissions that the caller has on the specified Table or Backup resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.test_iam_permissions.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async - */ +/** + * Returns permissions that the caller has on the specified table resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.test_iam_permissions.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async + */ testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | undefined, - {} | undefined - ] - >; + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: - | CallOptions - | Callback< + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | undefined, - {} | undefined - ] - > | void { + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); } - /** - * Creates a new table from the specified snapshot. The target table must - * not exist. The snapshot and the table must be in the same instance. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance in which to create the table. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {string} request.tableId - * Required. The name by which the new table should be referred to within the parent - * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. - * @param {string} request.sourceSnapshot - * Required. The unique name of the snapshot from which to restore the table. The - * snapshot and the table must be in the same instance. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async - */ +/** + * Creates a new table from the specified snapshot. The target table must + * not exist. The snapshot and the table must be in the same instance. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance in which to create the table. + * Values are of the form `projects/{project}/instances/{instance}`. + * @param {string} request.tableId + * Required. The name by which the new table should be referred to within the + * parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + * @param {string} request.sourceSnapshot + * Required. The unique name of the snapshot from which to restore the table. + * The snapshot and the table must be in the same instance. Values are of the + * form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async + */ createTableFromSnapshot( - request?: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableFromSnapshotMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; createTableFromSnapshot( - request: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableFromSnapshotMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createTableFromSnapshot( - request: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableFromSnapshotMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createTableFromSnapshot( - request?: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableFromSnapshotMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableFromSnapshotMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableFromSnapshotMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); - return this.innerApiCalls.createTableFromSnapshot( - request, - options, - callback - ); + return this.innerApiCalls.createTableFromSnapshot(request, options, callback); } - /** - * Check the status of the long running operation returned by `createTableFromSnapshot()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async - */ - async checkCreateTableFromSnapshotProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.Table, - protos.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `createTableFromSnapshot()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async + */ + async checkCreateTableFromSnapshotProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.createTableFromSnapshot, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.Table, - protos.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata - >; + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createTableFromSnapshot, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Creates a new snapshot in the specified cluster from the specified - * source table. The cluster and the table must be in the same instance. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the table to have the snapshot taken. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {string} request.cluster - * Required. The name of the cluster where the snapshot will be created in. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {string} request.snapshotId - * Required. The ID by which the new snapshot should be referred to within the parent - * cluster, e.g., `mysnapshot` of the form: `{@link -_.a-zA-Z0-9|_a-zA-Z0-9}*` - * rather than - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. - * @param {google.protobuf.Duration} request.ttl - * The amount of time that the new snapshot can stay active after it is - * created. Once 'ttl' expires, the snapshot will get deleted. The maximum - * amount of time a snapshot can stay active is 7 days. If 'ttl' is not - * specified, the default value of 24 hours will be used. - * @param {string} request.description - * Description of the snapshot. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.snapshot_table.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async - */ +/** + * Restores a specified table which was accidentally deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the table to be restored. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.undelete_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_UndeleteTable_async + */ + undeleteTable( + request?: protos.google.bigtable.admin.v2.IUndeleteTableRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + undeleteTable( + request: protos.google.bigtable.admin.v2.IUndeleteTableRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeleteTable( + request: protos.google.bigtable.admin.v2.IUndeleteTableRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeleteTable( + request?: protos.google.bigtable.admin.v2.IUndeleteTableRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.undeleteTable(request, options, callback); + } +/** + * Check the status of the long running operation returned by `undeleteTable()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.undelete_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_UndeleteTable_async + */ + async checkUndeleteTableProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.undeleteTable, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new snapshot in the specified cluster from the specified + * source table. The cluster and the table must be in the same instance. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the table to have the snapshot taken. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {string} request.cluster + * Required. The name of the cluster where the snapshot will be created in. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {string} request.snapshotId + * Required. The ID by which the new snapshot should be referred to within the + * parent cluster, e.g., `mysnapshot` of the form: + * `{@link -_.a-zA-Z0-9|_a-zA-Z0-9}*` rather than + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. + * @param {google.protobuf.Duration} request.ttl + * The amount of time that the new snapshot can stay active after it is + * created. Once 'ttl' expires, the snapshot will get deleted. The maximum + * amount of time a snapshot can stay active is 7 days. If 'ttl' is not + * specified, the default value of 24 hours will be used. + * @param {string} request.description + * Description of the snapshot. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.snapshot_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async + */ snapshotTable( - request?: protos.google.bigtable.admin.v2.ISnapshotTableRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.ISnapshotTableMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.ISnapshotTableRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; snapshotTable( - request: protos.google.bigtable.admin.v2.ISnapshotTableRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.ISnapshotTableMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ISnapshotTableRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; snapshotTable( - request: protos.google.bigtable.admin.v2.ISnapshotTableRequest, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.ISnapshotTableMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ISnapshotTableRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; snapshotTable( - request?: protos.google.bigtable.admin.v2.ISnapshotTableRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.ISnapshotTableMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.ISnapshotTableMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.ISnapshotTableMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.ISnapshotTableRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); this.initialize(); return this.innerApiCalls.snapshotTable(request, options, callback); } - /** - * Check the status of the long running operation returned by `snapshotTable()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.snapshot_table.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async - */ - async checkSnapshotTableProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.Snapshot, - protos.google.bigtable.admin.v2.SnapshotTableMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `snapshotTable()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.snapshot_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async + */ + async checkSnapshotTableProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.snapshotTable, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.Snapshot, - protos.google.bigtable.admin.v2.SnapshotTableMetadata - >; + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.snapshotTable, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Starts creating a new Cloud Bigtable Backup. The returned backup - * {@link google.longrunning.Operation|long-running operation} can be used to - * track creation of the backup. The - * {@link google.longrunning.Operation.metadata|metadata} field type is - * {@link google.bigtable.admin.v2.CreateBackupMetadata|CreateBackupMetadata}. The - * {@link google.longrunning.Operation.response|response} field type is - * {@link google.bigtable.admin.v2.Backup|Backup}, if successful. Cancelling the returned operation will stop the - * creation and delete the backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. This must be one of the clusters in the instance in which this - * table is located. The backup will be stored in this cluster. Values are - * of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {string} request.backupId - * Required. The id of the backup to be created. The `backup_id` along with - * the parent `parent` are combined as {parent}/backups/{backup_id} to create - * the full backup name, of the form: - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. - * This string must be between 1 and 50 characters in length and match the - * regex {@link -_.a-zA-Z0-9|_a-zA-Z0-9}*. - * @param {google.bigtable.admin.v2.Backup} request.backup - * Required. The backup to create. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.create_backup.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async - */ +/** + * Starts creating a new Cloud Bigtable Backup. The returned backup + * {@link google.longrunning.Operation|long-running operation} can be used to + * track creation of the backup. The + * {@link google.longrunning.Operation.metadata|metadata} field type is + * {@link google.bigtable.admin.v2.CreateBackupMetadata|CreateBackupMetadata}. The + * {@link google.longrunning.Operation.response|response} field type is + * {@link google.bigtable.admin.v2.Backup|Backup}, if successful. Cancelling the + * returned operation will stop the creation and delete the backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. This must be one of the clusters in the instance in which this + * table is located. The backup will be stored in this cluster. Values are + * of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {string} request.backupId + * Required. The id of the backup to be created. The `backup_id` along with + * the parent `parent` are combined as {parent}/backups/{backup_id} to create + * the full backup name, of the form: + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. + * This string must be between 1 and 50 characters in length and match the + * regex {@link -_.a-zA-Z0-9|_a-zA-Z0-9}*. + * @param {google.bigtable.admin.v2.Backup} request.backup + * Required. The backup to create. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async + */ createBackup( - request?: protos.google.bigtable.admin.v2.ICreateBackupRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.ICreateBackupMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; createBackup( - request: protos.google.bigtable.admin.v2.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.ICreateBackupMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createBackup( - request: protos.google.bigtable.admin.v2.ICreateBackupRequest, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.ICreateBackupMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; createBackup( - request?: protos.google.bigtable.admin.v2.ICreateBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.ICreateBackupMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.ICreateBackupMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.ICreateBackupMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.createBackup(request, options, callback); } - /** - * Check the status of the long running operation returned by `createBackup()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.create_backup.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async - */ - async checkCreateBackupProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.Backup, - protos.google.bigtable.admin.v2.CreateBackupMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `createBackup()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.createBackup, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.Backup, - protos.google.bigtable.admin.v2.CreateBackupMetadata - >; + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBackup, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Create a new table by restoring from a completed backup. The new table - * must be in the same project as the instance containing the backup. The - * returned table {@link google.longrunning.Operation|long-running operation} can - * be used to track the progress of the operation, and to cancel it. The - * {@link google.longrunning.Operation.metadata|metadata} field type is - * {@link google.bigtable.admin.RestoreTableMetadata|RestoreTableMetadata}. The - * {@link google.longrunning.Operation.response|response} type is - * {@link google.bigtable.admin.v2.Table|Table}, if successful. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the instance in which to create the restored - * table. This instance must be in the same project as the source backup. - * Values are of the form `projects//instances/`. - * @param {string} request.tableId - * Required. The id of the table to create and restore to. This - * table must not already exist. The `table_id` appended to - * `parent` forms the full table name of the form - * `projects//instances//tables/`. - * @param {string} request.backup - * Name of the backup from which to restore. Values are of the form - * `projects//instances//clusters//backups/`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.restore_table.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async - */ +/** + * Create a new table by restoring from a completed backup. The new table + * must be in the same project as the instance containing the backup. The + * returned table {@link google.longrunning.Operation|long-running operation} can + * be used to track the progress of the operation, and to cancel it. The + * {@link google.longrunning.Operation.metadata|metadata} field type is + * {@link google.bigtable.admin.RestoreTableMetadata|RestoreTableMetadata}. The + * {@link google.longrunning.Operation.response|response} type is + * {@link google.bigtable.admin.v2.Table|Table}, if successful. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the instance in which to create the restored + * table. This instance must be in the same project as the source backup. + * Values are of the form `projects//instances/`. + * @param {string} request.tableId + * Required. The id of the table to create and restore to. This + * table must not already exist. The `table_id` appended to + * `parent` forms the full table name of the form + * `projects//instances//tables/`. + * @param {string} request.backup + * Name of the backup from which to restore. Values are of the form + * `projects//instances//clusters//backups/`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.restore_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async + */ restoreTable( - request?: protos.google.bigtable.admin.v2.IRestoreTableRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IRestoreTableMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; + request?: protos.google.bigtable.admin.v2.IRestoreTableRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; restoreTable( - request: protos.google.bigtable.admin.v2.IRestoreTableRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IRestoreTableMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IRestoreTableRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; restoreTable( - request: protos.google.bigtable.admin.v2.IRestoreTableRequest, - callback: Callback< - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IRestoreTableMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.bigtable.admin.v2.IRestoreTableRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; restoreTable( - request?: protos.google.bigtable.admin.v2.IRestoreTableRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IRestoreTableMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IRestoreTableMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IRestoreTableMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { + request?: protos.google.bigtable.admin.v2.IRestoreTableRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.restoreTable(request, options, callback); } - /** - * Check the status of the long running operation returned by `restoreTable()`. - * @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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.restore_table.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async - */ - async checkRestoreTableProgress( - name: string - ): Promise< - LROperation< - protos.google.bigtable.admin.v2.Table, - protos.google.bigtable.admin.v2.RestoreTableMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); +/** + * Check the status of the long running operation returned by `restoreTable()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.restore_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async + */ + async checkRestoreTableProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.restoreTable, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.bigtable.admin.v2.Table, - protos.google.bigtable.admin.v2.RestoreTableMetadata - >; + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restoreTable, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; } - /** - * Lists all tables served from a specified instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which tables should be listed. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {google.bigtable.admin.v2.Table.View} request.view - * The view to be applied to the returned tables' fields. - * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @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 Array of [Table]{@link google.bigtable.admin.v2.Table}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTablesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ +/** + * Copy a Cloud Bigtable backup to a new backup in the destination cluster + * located in the destination instance and project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the destination cluster that will contain the backup + * copy. The cluster must already exist. Values are of the form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {string} request.backupId + * Required. The id of the new backup. The `backup_id` along with `parent` + * are combined as `{parent}/backups/{backup_id}` to create the full backup + * name, of the form: + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. + * This string must be between 1 and 50 characters in length and match the + * regex `{@link -_.a-zA-Z0-9|_a-zA-Z0-9}*`. + * @param {string} request.sourceBackup + * Required. The source backup to be copied from. + * The source backup needs to be in READY state for it to be copied. + * Copying a copied backup is not allowed. + * Once CopyBackup is in progress, the source backup cannot be deleted or + * cleaned up on expiration until CopyBackup is finished. + * Values are of the form: + * `projects//instances//clusters//backups/`. + * @param {google.protobuf.Timestamp} request.expireTime + * Required. Required. The expiration time of the copied backup with + * microsecond granularity that must be at least 6 hours and at most 30 days + * from the time the request is received. Once the `expire_time` has + * passed, Cloud Bigtable will delete the backup and free the resources used + * by the backup. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.copy_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CopyBackup_async + */ + copyBackup( + request?: protos.google.bigtable.admin.v2.ICopyBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + copyBackup( + request: protos.google.bigtable.admin.v2.ICopyBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + copyBackup( + request: protos.google.bigtable.admin.v2.ICopyBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + copyBackup( + request?: protos.google.bigtable.admin.v2.ICopyBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.copyBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `copyBackup()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.copy_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CopyBackup_async + */ + async checkCopyBackupProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.copyBackup, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all tables served from a specified instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which tables should be + * listed. Values are of the form `projects/{project}/instances/{instance}`. + * @param {google.bigtable.admin.v2.Table.View} request.view + * The view to be applied to the returned tables' fields. + * Only NAME_ONLY view (default), REPLICATION_VIEW and ENCRYPTION_VIEW are + * supported. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @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 Array of [Table]{@link google.bigtable.admin.v2.Table}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listTablesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listTables( - request?: protos.google.bigtable.admin.v2.IListTablesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.ITable[], - protos.google.bigtable.admin.v2.IListTablesRequest | null, - protos.google.bigtable.admin.v2.IListTablesResponse - ] - >; + request?: protos.google.bigtable.admin.v2.IListTablesRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ITable[], + protos.google.bigtable.admin.v2.IListTablesRequest|null, + protos.google.bigtable.admin.v2.IListTablesResponse + ]>; listTables( - request: protos.google.bigtable.admin.v2.IListTablesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListTablesRequest, - protos.google.bigtable.admin.v2.IListTablesResponse | null | undefined, - protos.google.bigtable.admin.v2.ITable - > - ): void; + request: protos.google.bigtable.admin.v2.IListTablesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListTablesRequest, + protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, + protos.google.bigtable.admin.v2.ITable>): void; listTables( - request: protos.google.bigtable.admin.v2.IListTablesRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListTablesRequest, - protos.google.bigtable.admin.v2.IListTablesResponse | null | undefined, - protos.google.bigtable.admin.v2.ITable - > - ): void; + request: protos.google.bigtable.admin.v2.IListTablesRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListTablesRequest, + protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, + protos.google.bigtable.admin.v2.ITable>): void; listTables( - request?: protos.google.bigtable.admin.v2.IListTablesRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< + request?: protos.google.bigtable.admin.v2.IListTablesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< protos.google.bigtable.admin.v2.IListTablesRequest, - | protos.google.bigtable.admin.v2.IListTablesResponse - | null - | undefined, - protos.google.bigtable.admin.v2.ITable - >, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListTablesRequest, - protos.google.bigtable.admin.v2.IListTablesResponse | null | undefined, - protos.google.bigtable.admin.v2.ITable - > - ): Promise< - [ - protos.google.bigtable.admin.v2.ITable[], - protos.google.bigtable.admin.v2.IListTablesRequest | null, - protos.google.bigtable.admin.v2.IListTablesResponse - ] - > | void { + protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, + protos.google.bigtable.admin.v2.ITable>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListTablesRequest, + protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, + protos.google.bigtable.admin.v2.ITable>): + Promise<[ + protos.google.bigtable.admin.v2.ITable[], + protos.google.bigtable.admin.v2.IListTablesRequest|null, + protos.google.bigtable.admin.v2.IListTablesResponse + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.listTables(request, options, callback); } - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which tables should be listed. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {google.bigtable.admin.v2.Table.View} request.view - * The view to be applied to the returned tables' fields. - * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Table]{@link google.bigtable.admin.v2.Table} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listTablesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which tables should be + * listed. Values are of the form `projects/{project}/instances/{instance}`. + * @param {google.bigtable.admin.v2.Table.View} request.view + * The view to be applied to the returned tables' fields. + * Only NAME_ONLY view (default), REPLICATION_VIEW and ENCRYPTION_VIEW are + * supported. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Table]{@link google.bigtable.admin.v2.Table} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listTablesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listTablesStream( - request?: protos.google.bigtable.admin.v2.IListTablesRequest, - options?: CallOptions - ): Transform { + request?: protos.google.bigtable.admin.v2.IListTablesRequest, + options?: CallOptions): + Transform{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); const defaultCallSettings = this._defaults['listTables']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTables.createStream( - this.innerApiCalls.listTables as gax.GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listTables`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which tables should be listed. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {google.bigtable.admin.v2.Table.View} request.view - * The view to be applied to the returned tables' fields. - * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Table]{@link google.bigtable.admin.v2.Table}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.list_tables.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async - */ + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTables.createStream( + this.innerApiCalls.listTables as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTables`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which tables should be + * listed. Values are of the form `projects/{project}/instances/{instance}`. + * @param {google.bigtable.admin.v2.Table.View} request.view + * The view to be applied to the returned tables' fields. + * Only NAME_ONLY view (default), REPLICATION_VIEW and ENCRYPTION_VIEW are + * supported. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Table]{@link google.bigtable.admin.v2.Table}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.list_tables.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async + */ listTablesAsync( - request?: protos.google.bigtable.admin.v2.IListTablesRequest, - options?: CallOptions - ): AsyncIterable { + request?: protos.google.bigtable.admin.v2.IListTablesRequest, + options?: CallOptions): + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); const defaultCallSettings = this._defaults['listTables']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -2700,149 +2431,138 @@ export class BigtableTableAdminClient { callSettings ) as AsyncIterable; } - /** - * Lists all snapshots associated with the specified cluster. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the cluster for which snapshots should be listed. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {number} request.pageSize - * The maximum number of snapshots to return per page. - * CURRENTLY UNIMPLEMENTED AND IGNORED. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @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 Array of [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSnapshotsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ + /** + * Lists all snapshots associated with the specified cluster. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the cluster for which snapshots should be + * listed. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {number} request.pageSize + * The maximum number of snapshots to return per page. + * CURRENTLY UNIMPLEMENTED AND IGNORED. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @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 Array of [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSnapshotsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listSnapshots( - request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.ISnapshot[], - protos.google.bigtable.admin.v2.IListSnapshotsRequest | null, - protos.google.bigtable.admin.v2.IListSnapshotsResponse - ] - >; + request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ISnapshot[], + protos.google.bigtable.admin.v2.IListSnapshotsRequest|null, + protos.google.bigtable.admin.v2.IListSnapshotsResponse + ]>; listSnapshots( - request: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListSnapshotsRequest, - protos.google.bigtable.admin.v2.IListSnapshotsResponse | null | undefined, - protos.google.bigtable.admin.v2.ISnapshot - > - ): void; + request: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListSnapshotsRequest, + protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, + protos.google.bigtable.admin.v2.ISnapshot>): void; listSnapshots( - request: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListSnapshotsRequest, - protos.google.bigtable.admin.v2.IListSnapshotsResponse | null | undefined, - protos.google.bigtable.admin.v2.ISnapshot - > - ): void; + request: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListSnapshotsRequest, + protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, + protos.google.bigtable.admin.v2.ISnapshot>): void; listSnapshots( - request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< + request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< protos.google.bigtable.admin.v2.IListSnapshotsRequest, - | protos.google.bigtable.admin.v2.IListSnapshotsResponse - | null - | undefined, - protos.google.bigtable.admin.v2.ISnapshot - >, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListSnapshotsRequest, - protos.google.bigtable.admin.v2.IListSnapshotsResponse | null | undefined, - protos.google.bigtable.admin.v2.ISnapshot - > - ): Promise< - [ - protos.google.bigtable.admin.v2.ISnapshot[], - protos.google.bigtable.admin.v2.IListSnapshotsRequest | null, - protos.google.bigtable.admin.v2.IListSnapshotsResponse - ] - > | void { + protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, + protos.google.bigtable.admin.v2.ISnapshot>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListSnapshotsRequest, + protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, + protos.google.bigtable.admin.v2.ISnapshot>): + Promise<[ + protos.google.bigtable.admin.v2.ISnapshot[], + protos.google.bigtable.admin.v2.IListSnapshotsRequest|null, + protos.google.bigtable.admin.v2.IListSnapshotsResponse + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.listSnapshots(request, options, callback); } - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the cluster for which snapshots should be listed. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {number} request.pageSize - * The maximum number of snapshots to return per page. - * CURRENTLY UNIMPLEMENTED AND IGNORED. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Snapshot]{@link google.bigtable.admin.v2.Snapshot} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSnapshotsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the cluster for which snapshots should be + * listed. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {number} request.pageSize + * The maximum number of snapshots to return per page. + * CURRENTLY UNIMPLEMENTED AND IGNORED. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Snapshot]{@link google.bigtable.admin.v2.Snapshot} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSnapshotsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listSnapshotsStream( - request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - options?: CallOptions - ): Transform { + request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + options?: CallOptions): + Transform{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); const defaultCallSettings = this._defaults['listSnapshots']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -2853,48 +2573,49 @@ export class BigtableTableAdminClient { ); } - /** - * Equivalent to `listSnapshots`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the cluster for which snapshots should be listed. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {number} request.pageSize - * The maximum number of snapshots to return per page. - * CURRENTLY UNIMPLEMENTED AND IGNORED. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.list_snapshots.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async - */ +/** + * Equivalent to `listSnapshots`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the cluster for which snapshots should be + * listed. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {number} request.pageSize + * The maximum number of snapshots to return per page. + * CURRENTLY UNIMPLEMENTED AND IGNORED. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.list_snapshots.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async + */ listSnapshotsAsync( - request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - options?: CallOptions - ): AsyncIterable { + request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + options?: CallOptions): + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); const defaultCallSettings = this._defaults['listSnapshots']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -2904,256 +2625,249 @@ export class BigtableTableAdminClient { callSettings ) as AsyncIterable; } - /** - * Lists Cloud Bigtable backups. Returns both completed and pending - * backups. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The cluster to list backups from. Values are of the - * form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list backups for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {string} request.filter - * A filter expression that filters backups listed in the response. - * The expression must specify the field name, a comparison operator, - * and the value that you want to use for filtering. The value must be a - * string, a number, or a boolean. The comparison operator must be - * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is - * roughly synonymous with equality. Filter rules are case insensitive. - * - * The fields eligible for filtering are: - * * `name` - * * `source_table` - * * `state` - * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. By default, each expression is an AND expression. However, - * you can include AND, OR, and NOT expressions explicitly. - * - * Some examples of using filters are: - * - * * `name:"exact"` --> The backup's name is the string "exact". - * * `name:howl` --> The backup's name contains the string "howl". - * * `source_table:prod` - * --> The source_table's name contains the string "prod". - * * `state:CREATING` --> The backup is pending creation. - * * `state:READY` --> The backup is fully created and ready for use. - * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` - * --> The backup name contains the string "howl" and start_time - * of the backup is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB - * @param {string} request.orderBy - * An expression for specifying the sort order of the results of the request. - * The string value should specify one or more fields in {@link google.bigtable.admin.v2.Backup|Backup}. The full - * syntax is described at https://aip.dev/132#ordering. - * - * Fields supported are: - * * name - * * source_table - * * expire_time - * * start_time - * * end_time - * * size_bytes - * * state - * - * For example, "start_time". The default sorting order is ascending. - * To specify descending order for the field, a suffix " desc" should - * be appended to the field name. For example, "start_time desc". - * Redundant space characters in the syntax are insigificant. - * - * If order_by is empty, results will be sorted by `start_time` in descending - * order starting from the most recently created backup. - * @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. - * @param {string} request.pageToken - * If non-empty, `page_token` should contain a - * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} from a - * previous {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the same `parent` and with the same - * `filter`. - * @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 Array of [Backup]{@link google.bigtable.admin.v2.Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ + /** + * Lists Cloud Bigtable backups. Returns both completed and pending + * backups. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster to list backups from. Values are of the + * form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list backups for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {string} request.filter + * A filter expression that filters backups listed in the response. + * The expression must specify the field name, a comparison operator, + * and the value that you want to use for filtering. The value must be a + * string, a number, or a boolean. The comparison operator must be + * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is + * roughly synonymous with equality. Filter rules are case insensitive. + * + * The fields eligible for filtering are: + * * `name` + * * `source_table` + * * `state` + * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. By default, each expression is an AND expression. However, + * you can include AND, OR, and NOT expressions explicitly. + * + * Some examples of using filters are: + * + * * `name:"exact"` --> The backup's name is the string "exact". + * * `name:howl` --> The backup's name contains the string "howl". + * * `source_table:prod` + * --> The source_table's name contains the string "prod". + * * `state:CREATING` --> The backup is pending creation. + * * `state:READY` --> The backup is fully created and ready for use. + * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` + * --> The backup name contains the string "howl" and start_time + * of the backup is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB + * @param {string} request.orderBy + * An expression for specifying the sort order of the results of the request. + * The string value should specify one or more fields in + * {@link google.bigtable.admin.v2.Backup|Backup}. The full syntax is described at + * https://aip.dev/132#ordering. + * + * Fields supported are: + * * name + * * source_table + * * expire_time + * * start_time + * * end_time + * * size_bytes + * * state + * + * For example, "start_time". The default sorting order is ascending. + * To specify descending order for the field, a suffix " desc" should + * be appended to the field name. For example, "start_time desc". + * Redundant space characters in the syntax are insigificant. + * + * If order_by is empty, results will be sorted by `start_time` in descending + * order starting from the most recently created backup. + * @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. + * @param {string} request.pageToken + * If non-empty, `page_token` should contain a + * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} + * from a previous + * {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the + * same `parent` and with the same `filter`. + * @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 Array of [Backup]{@link google.bigtable.admin.v2.Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listBackups( - request?: protos.google.bigtable.admin.v2.IListBackupsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.bigtable.admin.v2.IBackup[], - protos.google.bigtable.admin.v2.IListBackupsRequest | null, - protos.google.bigtable.admin.v2.IListBackupsResponse - ] - >; + request?: protos.google.bigtable.admin.v2.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IBackup[], + protos.google.bigtable.admin.v2.IListBackupsRequest|null, + protos.google.bigtable.admin.v2.IListBackupsResponse + ]>; listBackups( - request: protos.google.bigtable.admin.v2.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListBackupsRequest, - protos.google.bigtable.admin.v2.IListBackupsResponse | null | undefined, - protos.google.bigtable.admin.v2.IBackup - > - ): void; + request: protos.google.bigtable.admin.v2.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListBackupsRequest, + protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, + protos.google.bigtable.admin.v2.IBackup>): void; listBackups( - request: protos.google.bigtable.admin.v2.IListBackupsRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListBackupsRequest, - protos.google.bigtable.admin.v2.IListBackupsResponse | null | undefined, - protos.google.bigtable.admin.v2.IBackup - > - ): void; + request: protos.google.bigtable.admin.v2.IListBackupsRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListBackupsRequest, + protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, + protos.google.bigtable.admin.v2.IBackup>): void; listBackups( - request?: protos.google.bigtable.admin.v2.IListBackupsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< + request?: protos.google.bigtable.admin.v2.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< protos.google.bigtable.admin.v2.IListBackupsRequest, - | protos.google.bigtable.admin.v2.IListBackupsResponse - | null - | undefined, - protos.google.bigtable.admin.v2.IBackup - >, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListBackupsRequest, - protos.google.bigtable.admin.v2.IListBackupsResponse | null | undefined, - protos.google.bigtable.admin.v2.IBackup - > - ): Promise< - [ - protos.google.bigtable.admin.v2.IBackup[], - protos.google.bigtable.admin.v2.IListBackupsRequest | null, - protos.google.bigtable.admin.v2.IListBackupsResponse - ] - > | void { + protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, + protos.google.bigtable.admin.v2.IBackup>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListBackupsRequest, + protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, + protos.google.bigtable.admin.v2.IBackup>): + Promise<[ + protos.google.bigtable.admin.v2.IBackup[], + protos.google.bigtable.admin.v2.IListBackupsRequest|null, + protos.google.bigtable.admin.v2.IListBackupsResponse + ]>|void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); this.initialize(); return this.innerApiCalls.listBackups(request, options, callback); } - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The cluster to list backups from. Values are of the - * form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list backups for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {string} request.filter - * A filter expression that filters backups listed in the response. - * The expression must specify the field name, a comparison operator, - * and the value that you want to use for filtering. The value must be a - * string, a number, or a boolean. The comparison operator must be - * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is - * roughly synonymous with equality. Filter rules are case insensitive. - * - * The fields eligible for filtering are: - * * `name` - * * `source_table` - * * `state` - * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. By default, each expression is an AND expression. However, - * you can include AND, OR, and NOT expressions explicitly. - * - * Some examples of using filters are: - * - * * `name:"exact"` --> The backup's name is the string "exact". - * * `name:howl` --> The backup's name contains the string "howl". - * * `source_table:prod` - * --> The source_table's name contains the string "prod". - * * `state:CREATING` --> The backup is pending creation. - * * `state:READY` --> The backup is fully created and ready for use. - * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` - * --> The backup name contains the string "howl" and start_time - * of the backup is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB - * @param {string} request.orderBy - * An expression for specifying the sort order of the results of the request. - * The string value should specify one or more fields in {@link google.bigtable.admin.v2.Backup|Backup}. The full - * syntax is described at https://aip.dev/132#ordering. - * - * Fields supported are: - * * name - * * source_table - * * expire_time - * * start_time - * * end_time - * * size_bytes - * * state - * - * For example, "start_time". The default sorting order is ascending. - * To specify descending order for the field, a suffix " desc" should - * be appended to the field name. For example, "start_time desc". - * Redundant space characters in the syntax are insigificant. - * - * If order_by is empty, results will be sorted by `start_time` in descending - * order starting from the most recently created backup. - * @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. - * @param {string} request.pageToken - * If non-empty, `page_token` should contain a - * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} from a - * previous {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the same `parent` and with the same - * `filter`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Backup]{@link google.bigtable.admin.v2.Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster to list backups from. Values are of the + * form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list backups for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {string} request.filter + * A filter expression that filters backups listed in the response. + * The expression must specify the field name, a comparison operator, + * and the value that you want to use for filtering. The value must be a + * string, a number, or a boolean. The comparison operator must be + * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is + * roughly synonymous with equality. Filter rules are case insensitive. + * + * The fields eligible for filtering are: + * * `name` + * * `source_table` + * * `state` + * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. By default, each expression is an AND expression. However, + * you can include AND, OR, and NOT expressions explicitly. + * + * Some examples of using filters are: + * + * * `name:"exact"` --> The backup's name is the string "exact". + * * `name:howl` --> The backup's name contains the string "howl". + * * `source_table:prod` + * --> The source_table's name contains the string "prod". + * * `state:CREATING` --> The backup is pending creation. + * * `state:READY` --> The backup is fully created and ready for use. + * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` + * --> The backup name contains the string "howl" and start_time + * of the backup is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB + * @param {string} request.orderBy + * An expression for specifying the sort order of the results of the request. + * The string value should specify one or more fields in + * {@link google.bigtable.admin.v2.Backup|Backup}. The full syntax is described at + * https://aip.dev/132#ordering. + * + * Fields supported are: + * * name + * * source_table + * * expire_time + * * start_time + * * end_time + * * size_bytes + * * state + * + * For example, "start_time". The default sorting order is ascending. + * To specify descending order for the field, a suffix " desc" should + * be appended to the field name. For example, "start_time desc". + * Redundant space characters in the syntax are insigificant. + * + * If order_by is empty, results will be sorted by `start_time` in descending + * order starting from the most recently created backup. + * @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. + * @param {string} request.pageToken + * If non-empty, `page_token` should contain a + * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} + * from a previous + * {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the + * same `parent` and with the same `filter`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Backup]{@link google.bigtable.admin.v2.Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listBackupsStream( - request?: protos.google.bigtable.admin.v2.IListBackupsRequest, - options?: CallOptions - ): Transform { + request?: protos.google.bigtable.admin.v2.IListBackupsRequest, + options?: CallOptions): + Transform{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); const defaultCallSettings = this._defaults['listBackups']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -3164,113 +2878,373 @@ export class BigtableTableAdminClient { ); } - /** - * Equivalent to `listBackups`, but returns an iterable object. +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster to list backups from. Values are of the + * form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list backups for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {string} request.filter + * A filter expression that filters backups listed in the response. + * The expression must specify the field name, a comparison operator, + * and the value that you want to use for filtering. The value must be a + * string, a number, or a boolean. The comparison operator must be + * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is + * roughly synonymous with equality. Filter rules are case insensitive. + * + * The fields eligible for filtering are: + * * `name` + * * `source_table` + * * `state` + * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. By default, each expression is an AND expression. However, + * you can include AND, OR, and NOT expressions explicitly. + * + * Some examples of using filters are: + * + * * `name:"exact"` --> The backup's name is the string "exact". + * * `name:howl` --> The backup's name contains the string "howl". + * * `source_table:prod` + * --> The source_table's name contains the string "prod". + * * `state:CREATING` --> The backup is pending creation. + * * `state:READY` --> The backup is fully created and ready for use. + * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` + * --> The backup name contains the string "howl" and start_time + * of the backup is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB + * @param {string} request.orderBy + * An expression for specifying the sort order of the results of the request. + * The string value should specify one or more fields in + * {@link google.bigtable.admin.v2.Backup|Backup}. The full syntax is described at + * https://aip.dev/132#ordering. + * + * Fields supported are: + * * name + * * source_table + * * expire_time + * * start_time + * * end_time + * * size_bytes + * * state + * + * For example, "start_time". The default sorting order is ascending. + * To specify descending order for the field, a suffix " desc" should + * be appended to the field name. For example, "start_time desc". + * Redundant space characters in the syntax are insigificant. + * + * If order_by is empty, results will be sorted by `start_time` in descending + * order starting from the most recently created backup. + * @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. + * @param {string} request.pageToken + * If non-empty, `page_token` should contain a + * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} + * from a previous + * {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the + * same `parent` and with the same `filter`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Backup]{@link google.bigtable.admin.v2.Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.list_backups.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.bigtable.admin.v2.IListBackupsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. - * @param {string} request.parent - * Required. The cluster to list backups from. Values are of the - * form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list backups for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. * @param {string} request.filter - * A filter expression that filters backups listed in the response. - * The expression must specify the field name, a comparison operator, - * and the value that you want to use for filtering. The value must be a - * string, a number, or a boolean. The comparison operator must be - * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is - * roughly synonymous with equality. Filter rules are case insensitive. - * - * The fields eligible for filtering are: - * * `name` - * * `source_table` - * * `state` - * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. By default, each expression is an AND expression. However, - * you can include AND, OR, and NOT expressions explicitly. - * - * Some examples of using filters are: - * - * * `name:"exact"` --> The backup's name is the string "exact". - * * `name:howl` --> The backup's name contains the string "howl". - * * `source_table:prod` - * --> The source_table's name contains the string "prod". - * * `state:CREATING` --> The backup is pending creation. - * * `state:READY` --> The backup is fully created and ready for use. - * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` - * --> The backup name contains the string "howl" and start_time - * of the backup is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB - * @param {string} request.orderBy - * An expression for specifying the sort order of the results of the request. - * The string value should specify one or more fields in {@link google.bigtable.admin.v2.Backup|Backup}. The full - * syntax is described at https://aip.dev/132#ordering. - * - * Fields supported are: - * * name - * * source_table - * * expire_time - * * start_time - * * end_time - * * size_bytes - * * state - * - * For example, "start_time". The default sorting order is ascending. - * To specify descending order for the field, a suffix " desc" should - * be appended to the field name. For example, "start_time desc". - * Redundant space characters in the syntax are insigificant. - * - * If order_by is empty, results will be sorted by `start_time` in descending - * order starting from the most recently created backup. + * The standard list filter. * @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. + * The standard list page size. * @param {string} request.pageToken - * If non-empty, `page_token` should contain a - * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} from a - * previous {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the same `parent` and with the same - * `filter`. + * The standard list page token. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). * When you iterate the returned iterable, each element will be an object representing - * [Backup]{@link google.bigtable.admin.v2.Backup}. The API will be called under the hood as needed, once per the page, + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, * so you can stop the iteration when you don't need more results. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example include:samples/generated/v2/bigtable_table_admin.list_backups.js - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.bigtable.admin.v2.IListBackupsRequest, + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); } + // -------------------- // -- Path templates -- // -------------------- @@ -3283,7 +3257,7 @@ export class BigtableTableAdminClient { * @param {string} app_profile * @returns {string} Resource name string. */ - appProfilePath(project: string, instance: string, appProfile: string) { + appProfilePath(project:string,instance:string,appProfile:string) { return this.pathTemplates.appProfilePathTemplate.render({ project: project, instance: instance, @@ -3299,8 +3273,7 @@ export class BigtableTableAdminClient { * @returns {string} A string representing the project. */ matchProjectFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName) - .project; + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).project; } /** @@ -3311,8 +3284,7 @@ export class BigtableTableAdminClient { * @returns {string} A string representing the instance. */ matchInstanceFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName) - .instance; + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).instance; } /** @@ -3323,8 +3295,7 @@ export class BigtableTableAdminClient { * @returns {string} A string representing the app_profile. */ matchAppProfileFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName) - .app_profile; + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).app_profile; } /** @@ -3336,12 +3307,7 @@ export class BigtableTableAdminClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath( - project: string, - instance: string, - cluster: string, - backup: string - ) { + backupPath(project:string,instance:string,cluster:string,backup:string) { return this.pathTemplates.backupPathTemplate.render({ project: project, instance: instance, @@ -3402,7 +3368,7 @@ export class BigtableTableAdminClient { * @param {string} cluster * @returns {string} Resource name string. */ - clusterPath(project: string, instance: string, cluster: string) { + clusterPath(project:string,instance:string,cluster:string) { return this.pathTemplates.clusterPathTemplate.render({ project: project, instance: instance, @@ -3452,12 +3418,7 @@ export class BigtableTableAdminClient { * @param {string} hot_tablet * @returns {string} Resource name string. */ - hotTabletPath( - project: string, - instance: string, - cluster: string, - hotTablet: string - ) { + hotTabletPath(project:string,instance:string,cluster:string,hotTablet:string) { return this.pathTemplates.hotTabletPathTemplate.render({ project: project, instance: instance, @@ -3474,8 +3435,7 @@ export class BigtableTableAdminClient { * @returns {string} A string representing the project. */ matchProjectFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) - .project; + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).project; } /** @@ -3486,8 +3446,7 @@ export class BigtableTableAdminClient { * @returns {string} A string representing the instance. */ matchInstanceFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) - .instance; + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).instance; } /** @@ -3498,8 +3457,7 @@ export class BigtableTableAdminClient { * @returns {string} A string representing the cluster. */ matchClusterFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) - .cluster; + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).cluster; } /** @@ -3510,8 +3468,7 @@ export class BigtableTableAdminClient { * @returns {string} A string representing the hot_tablet. */ matchHotTabletFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) - .hot_tablet; + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).hot_tablet; } /** @@ -3521,7 +3478,7 @@ export class BigtableTableAdminClient { * @param {string} instance * @returns {string} Resource name string. */ - instancePath(project: string, instance: string) { + instancePath(project:string,instance:string) { return this.pathTemplates.instancePathTemplate.render({ project: project, instance: instance, @@ -3559,12 +3516,7 @@ export class BigtableTableAdminClient { * @param {string} snapshot * @returns {string} Resource name string. */ - snapshotPath( - project: string, - instance: string, - cluster: string, - snapshot: string - ) { + snapshotPath(project:string,instance:string,cluster:string,snapshot:string) { return this.pathTemplates.snapshotPathTemplate.render({ project: project, instance: instance, @@ -3625,7 +3577,7 @@ export class BigtableTableAdminClient { * @param {string} table * @returns {string} Resource name string. */ - tablePath(project: string, instance: string, table: string) { + tablePath(project:string,instance:string,table:string) { return this.pathTemplates.tablePathTemplate.render({ project: project, instance: instance, @@ -3677,6 +3629,7 @@ export class BigtableTableAdminClient { return this.bigtableTableAdminStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/src/v2/bigtable_table_admin_client_config.json b/src/v2/bigtable_table_admin_client_config.json index b6f59ab62..0a7f3ec40 100644 --- a/src/v2/bigtable_table_admin_client_config.json +++ b/src/v2/bigtable_table_admin_client_config.json @@ -35,6 +35,7 @@ "retry_params_name": "default" }, "CreateTableFromSnapshot": { + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, @@ -53,6 +54,10 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "UndeleteTable": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ModifyColumnFamilies": { "timeout_millis": 300000, "retry_codes_name": "non_idempotent", @@ -74,6 +79,7 @@ "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "SnapshotTable": { + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, @@ -93,32 +99,30 @@ "retry_params_name": "default" }, "CreateBackup": { - "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" }, "UpdateBackup": { - "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteBackup": { - "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" }, "RestoreTable": { - "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CopyBackup": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, diff --git a/src/v2/gapic_metadata.json b/src/v2/gapic_metadata.json index 8faad0b19..01d726ace 100644 --- a/src/v2/gapic_metadata.json +++ b/src/v2/gapic_metadata.json @@ -322,6 +322,11 @@ "createTableFromSnapshot" ] }, + "UndeleteTable": { + "methods": [ + "undeleteTable" + ] + }, "SnapshotTable": { "methods": [ "snapshotTable" @@ -337,6 +342,11 @@ "restoreTable" ] }, + "CopyBackup": { + "methods": [ + "copyBackup" + ] + }, "ListTables": { "methods": [ "listTables", @@ -443,6 +453,11 @@ "createTableFromSnapshot" ] }, + "UndeleteTable": { + "methods": [ + "undeleteTable" + ] + }, "SnapshotTable": { "methods": [ "snapshotTable" @@ -458,6 +473,11 @@ "restoreTable" ] }, + "CopyBackup": { + "methods": [ + "copyBackup" + ] + }, "ListTables": { "methods": [ "listTables", diff --git a/src/v2/index.ts b/src/v2/index.ts index 5ad012de7..28ff835fe 100644 --- a/src/v2/index.ts +++ b/src/v2/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,4 +18,3 @@ export {BigtableInstanceAdminClient} from './bigtable_instance_admin_client'; export {BigtableTableAdminClient} from './bigtable_table_admin_client'; -export {BigtableClient} from './bigtable_client'; diff --git a/test/gapic_bigtable_instance_admin_v2.ts b/test/gapic_bigtable_instance_admin_v2.ts index 0b37f0ad8..838b3780f 100644 --- a/test/gapic_bigtable_instance_admin_v2.ts +++ b/test/gapic_bigtable_instance_admin_v2.ts @@ -20,4232 +20,3552 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { describe, it } from 'mocha'; import * as bigtableinstanceadminModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall( - responses?: ResponseType[], - error?: Error -) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } } - } - const transformStub = error - ? sinon.stub().callsArgWith(2, error) - : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { - mockStream.write({}); - }); + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); } describe('v2.BigtableInstanceAdminClient', () => { - it('has servicePath', () => { - const servicePath = - bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = - bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableInstanceAdminStub, undefined); - await client.initialize(); - assert(client.bigtableInstanceAdminStub); - }); - - it('has close method for the initialized client', done => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.bigtableInstanceAdminStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableInstanceAdminStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetInstanceRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes getInstance without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetInstanceRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Instance() - ); - client.innerApiCalls.getInstance = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IInstance | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes getInstance with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetInstanceRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getInstance(request), expectedError); - assert( - (client.innerApiCalls.getInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes getInstance with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetInstanceRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('listInstances', () => { - it('invokes listInstances without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListInstancesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListInstancesResponse() - ); - client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); - const [response] = await client.listInstances(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listInstances as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes listInstances without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListInstancesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListInstancesResponse() - ); - client.innerApiCalls.listInstances = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInstances( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IListInstancesResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listInstances as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes listInstances with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListInstancesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listInstances = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listInstances(request), expectedError); - assert( - (client.innerApiCalls.listInstances as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes listInstances with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListInstancesRequest() - ); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listInstances(request), expectedError); - }); - }); - - describe('updateInstance', () => { - it('invokes updateInstance without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.Instance() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Instance() - ); - client.innerApiCalls.updateInstance = stubSimpleCall(expectedResponse); - const [response] = await client.updateInstance(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes updateInstance without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.Instance() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Instance() - ); - client.innerApiCalls.updateInstance = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInstance( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IInstance | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes updateInstance with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.Instance() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.updateInstance(request), expectedError); - assert( - (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes updateInstance with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.Instance() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateInstance(request), expectedError); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteInstanceRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteInstance = stubSimpleCall(expectedResponse); - const [response] = await client.deleteInstance(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteInstanceRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteInstance = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes deleteInstance with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteInstanceRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteInstance(request), expectedError); - assert( - (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes deleteInstance with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteInstanceRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteInstance(request), expectedError); - }); - }); - - describe('getCluster', () => { - it('invokes getCluster without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetClusterRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getCluster(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes getCluster without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetClusterRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Cluster() - ); - client.innerApiCalls.getCluster = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCluster( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.ICluster | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes getCluster with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetClusterRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCluster = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getCluster(request), expectedError); - assert( - (client.innerApiCalls.getCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes getCluster with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetClusterRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCluster(request), expectedError); - }); - }); - - describe('listClusters', () => { - it('invokes listClusters without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListClustersRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListClustersResponse() - ); - client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listClusters(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listClusters as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes listClusters without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListClustersRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListClustersResponse() - ); - client.innerApiCalls.listClusters = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClusters( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IListClustersResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listClusters as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes listClusters with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListClustersRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listClusters = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listClusters(request), expectedError); - assert( - (client.innerApiCalls.listClusters as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has servicePath', () => { + const servicePath = bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.servicePath; + assert(servicePath); }); - it('invokes listClusters with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListClustersRequest() - ); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listClusters(request), expectedError); - }); - }); - - describe('deleteCluster', () => { - it('invokes deleteCluster without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteClusterRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteCluster = stubSimpleCall(expectedResponse); - const [response] = await client.deleteCluster(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes deleteCluster without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteClusterRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteCluster = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCluster( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes deleteCluster with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteClusterRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteCluster(request), expectedError); - assert( - (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes deleteCluster with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteClusterRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteCluster(request), expectedError); - }); - }); - - describe('createAppProfile', () => { - it('invokes createAppProfile without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateAppProfileRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.AppProfile() - ); - client.innerApiCalls.createAppProfile = stubSimpleCall(expectedResponse); - const [response] = await client.createAppProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes createAppProfile without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateAppProfileRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.AppProfile() - ); - client.innerApiCalls.createAppProfile = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAppProfile( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IAppProfile | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes createAppProfile with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateAppProfileRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createAppProfile = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createAppProfile(request), expectedError); - assert( - (client.innerApiCalls.createAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has apiEndpoint', () => { + const apiEndpoint = bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.apiEndpoint; + assert(apiEndpoint); }); - it('invokes createAppProfile with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateAppProfileRequest() - ); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createAppProfile(request), expectedError); - }); - }); - - describe('getAppProfile', () => { - it('invokes getAppProfile without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetAppProfileRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.AppProfile() - ); - client.innerApiCalls.getAppProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getAppProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes getAppProfile without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetAppProfileRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.AppProfile() - ); - client.innerApiCalls.getAppProfile = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAppProfile( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IAppProfile | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes getAppProfile with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetAppProfileRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getAppProfile = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getAppProfile(request), expectedError); - assert( - (client.innerApiCalls.getAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes getAppProfile with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetAppProfileRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAppProfile(request), expectedError); - }); - }); - - describe('deleteAppProfile', () => { - it('invokes deleteAppProfile without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteAppProfileRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAppProfile = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAppProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has port', () => { + const port = bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.port; + assert(port); + assert(typeof port === 'number'); }); - it('invokes deleteAppProfile without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteAppProfileRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAppProfile = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAppProfile( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('should create a client with no option', () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient(); + assert(client); }); - it('invokes deleteAppProfile with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteAppProfileRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAppProfile = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteAppProfile(request), expectedError); - assert( - (client.innerApiCalls.deleteAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes deleteAppProfile with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteAppProfileRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAppProfile(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - ( - err?: Error | null, - result?: protos.google.iam.v1.IPolicy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes getIamPolicy with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getIamPolicy(request), expectedError); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - ( - err?: Error | null, - result?: protos.google.iam.v1.IPolicy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes setIamPolicy with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.setIamPolicy(request), expectedError); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = - stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - ( - err?: Error | null, - result?: protos.google.iam.v1.ITestIamPermissionsResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes testIamPermissions with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.testIamPermissions(request), expectedError); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateInstanceRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = - stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes createInstance without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateInstanceRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.ICreateInstanceMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.ICreateInstanceMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes createInstance with call error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateInstanceRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.createInstance(request), expectedError); - assert( - (client.innerApiCalls.createInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes createInstance with LRO error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateInstanceRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkCreateInstanceProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkCreateInstanceProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('partialUpdateInstance', () => { - it('invokes partialUpdateInstance without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest() - ); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = 'instance.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.partialUpdateInstance = - stubLongRunningCall(expectedResponse); - const [operation] = await client.partialUpdateInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.partialUpdateInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('should create a client with gRPC fallback', () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + fallback: true, + }); + assert(client); }); - it('invokes partialUpdateInstance without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest() - ); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = 'instance.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.partialUpdateInstance = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.partialUpdateInstance( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IUpdateInstanceMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); + it('has initialize method and supports deferred initialization', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableInstanceAdminStub, undefined); + await client.initialize(); + assert(client.bigtableInstanceAdminStub); + }); + + it('has close method for the initialized client', done => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.bigtableInstanceAdminStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableInstanceAdminStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getInstance', () => { + it('invokes getInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); + const [response] = await client.getInstance(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstance( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getInstance with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInstance(request), expectedError); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getInstance with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInstance(request), expectedError); + }); + }); + + describe('listInstances', () => { + it('invokes listInstances without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesResponse()); + client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); + const [response] = await client.listInstances(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listInstances without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesResponse()); + client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInstances( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IListInstancesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listInstances with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listInstances(request), expectedError); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listInstances with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listInstances(request), expectedError); + }); + }); + + describe('updateInstance', () => { + it('invokes updateInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + client.innerApiCalls.updateInstance = stubSimpleCall(expectedResponse); + const [response] = await client.updateInstance(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + client.innerApiCalls.updateInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInstance( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateInstance with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateInstance(request), expectedError); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateInstance with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateInstance(request), expectedError); + }); + }); + + describe('deleteInstance', () => { + it('invokes deleteInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteInstance = stubSimpleCall(expectedResponse); + const [response] = await client.deleteInstance(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInstance( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteInstance with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteInstance(request), expectedError); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteInstance with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteInstance(request), expectedError); + }); + }); + + describe('getCluster', () => { + it('invokes getCluster without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getCluster(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCluster( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ICluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCluster with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCluster(request), expectedError); + assert((client.innerApiCalls.getCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCluster with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCluster(request), expectedError); + }); + }); + + describe('listClusters', () => { + it('invokes listClusters without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersResponse()); + client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listClusters(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listClusters as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listClusters without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersResponse()); + client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClusters( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IListClustersResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listClusters as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listClusters with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listClusters(request), expectedError); + assert((client.innerApiCalls.listClusters as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listClusters with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listClusters(request), expectedError); + }); + }); + + describe('deleteCluster', () => { + it('invokes deleteCluster without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteCluster = stubSimpleCall(expectedResponse); + const [response] = await client.deleteCluster(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCluster( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteCluster with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteCluster(request), expectedError); + assert((client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCluster with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteCluster(request), expectedError); + }); + }); + + describe('createAppProfile', () => { + it('invokes createAppProfile without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); + client.innerApiCalls.createAppProfile = stubSimpleCall(expectedResponse); + const [response] = await client.createAppProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createAppProfile without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); + client.innerApiCalls.createAppProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAppProfile( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IAppProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createAppProfile with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAppProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createAppProfile(request), expectedError); + assert((client.innerApiCalls.createAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createAppProfile with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createAppProfile(request), expectedError); + }); + }); + + describe('getAppProfile', () => { + it('invokes getAppProfile without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); + client.innerApiCalls.getAppProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getAppProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAppProfile without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); + client.innerApiCalls.getAppProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAppProfile( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IAppProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getAppProfile with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAppProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAppProfile(request), expectedError); + assert((client.innerApiCalls.getAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAppProfile with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAppProfile(request), expectedError); + }); + }); + + describe('deleteAppProfile', () => { + it('invokes deleteAppProfile without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAppProfile = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAppProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAppProfile without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAppProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAppProfile( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAppProfile with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAppProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAppProfile(request), expectedError); + assert((client.innerApiCalls.deleteAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAppProfile with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAppProfile(request), expectedError); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + describe('createInstance', () => { + it('invokes createInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.createInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createInstance with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createInstance(request), expectedError); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createInstance with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateInstanceProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkCreateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateInstanceProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkCreateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('partialUpdateInstance', () => { + it('invokes partialUpdateInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.partialUpdateInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.partialUpdateInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.partialUpdateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes partialUpdateInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.partialUpdateInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.partialUpdateInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.partialUpdateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes partialUpdateInstance with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.partialUpdateInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.partialUpdateInstance(request), expectedError); + assert((client.innerApiCalls.partialUpdateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes partialUpdateInstance with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.partialUpdateInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.partialUpdateInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.partialUpdateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkPartialUpdateInstanceProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkPartialUpdateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkPartialUpdateInstanceProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkPartialUpdateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createCluster', () => { + it('invokes createCluster without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.createCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCluster with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createCluster(request), expectedError); + assert((client.innerApiCalls.createCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCluster with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createCluster(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateClusterProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkCreateClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateClusterProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkCreateClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateCluster', () => { + it('invokes updateCluster without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCluster with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCluster(request), expectedError); + assert((client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCluster with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCluster(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateClusterProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkUpdateClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateClusterProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkUpdateClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('partialUpdateCluster', () => { + it('invokes partialUpdateCluster without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); + request.cluster = {}; + request.cluster.name = ''; + const expectedHeaderRequestParams = "cluster.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.partialUpdateCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.partialUpdateCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.partialUpdateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes partialUpdateCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); + request.cluster = {}; + request.cluster.name = ''; + const expectedHeaderRequestParams = "cluster.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.partialUpdateCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.partialUpdateCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.partialUpdateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes partialUpdateCluster with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); + request.cluster = {}; + request.cluster.name = ''; + const expectedHeaderRequestParams = "cluster.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.partialUpdateCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.partialUpdateCluster(request), expectedError); + assert((client.innerApiCalls.partialUpdateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes partialUpdateCluster with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); + request.cluster = {}; + request.cluster.name = ''; + const expectedHeaderRequestParams = "cluster.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.partialUpdateCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.partialUpdateCluster(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.partialUpdateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkPartialUpdateClusterProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkPartialUpdateClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkPartialUpdateClusterProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkPartialUpdateClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateAppProfile', () => { + it('invokes updateAppProfile without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); + request.appProfile = {}; + request.appProfile.name = ''; + const expectedHeaderRequestParams = "app_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateAppProfile = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAppProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAppProfile without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); + request.appProfile = {}; + request.appProfile.name = ''; + const expectedHeaderRequestParams = "app_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateAppProfile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAppProfile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateAppProfile with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); + request.appProfile = {}; + request.appProfile.name = ''; + const expectedHeaderRequestParams = "app_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAppProfile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateAppProfile(request), expectedError); + assert((client.innerApiCalls.updateAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAppProfile with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); + request.appProfile = {}; + request.appProfile.name = ''; + const expectedHeaderRequestParams = "app_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAppProfile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateAppProfile(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateAppProfileProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkUpdateAppProfileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateAppProfileProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkUpdateAppProfileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listAppProfiles', () => { + it('invokes listAppProfiles without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + ]; + client.innerApiCalls.listAppProfiles = stubSimpleCall(expectedResponse); + const [response] = await client.listAppProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAppProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAppProfiles without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + ]; + client.innerApiCalls.listAppProfiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAppProfiles( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IAppProfile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAppProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAppProfiles with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAppProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAppProfiles(request), expectedError); + assert((client.innerApiCalls.listAppProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAppProfilesStream without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + ]; + client.descriptors.page.listAppProfiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAppProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.AppProfile[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.AppProfile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAppProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAppProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listAppProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAppProfilesStream with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listAppProfiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAppProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.AppProfile[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.AppProfile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAppProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAppProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listAppProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAppProfiles without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + ]; + client.descriptors.page.listAppProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.IAppProfile[] = []; + const iterable = client.listAppProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IUpdateInstanceMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.partialUpdateInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes partialUpdateInstance with call error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest() - ); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = 'instance.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.partialUpdateInstance = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.partialUpdateInstance(request), - expectedError - ); - assert( - (client.innerApiCalls.partialUpdateInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes partialUpdateInstance with LRO error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest() - ); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = 'instance.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.partialUpdateInstance = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.partialUpdateInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.partialUpdateInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes checkPartialUpdateInstanceProgress without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkPartialUpdateInstanceProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPartialUpdateInstanceProgress with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkPartialUpdateInstanceProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('createCluster', () => { - it('invokes createCluster without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateClusterRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = - stubLongRunningCall(expectedResponse); - const [operation] = await client.createCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes createCluster without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateClusterRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCluster( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.ICreateClusterMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAppProfiles with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listAppProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAppProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.IAppProfile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listHotTablets', () => { + it('invokes listHotTablets without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.innerApiCalls.listHotTablets = stubSimpleCall(expectedResponse); + const [response] = await client.listHotTablets(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listHotTablets without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.innerApiCalls.listHotTablets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHotTablets( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IHotTablet[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listHotTablets with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listHotTablets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listHotTablets(request), expectedError); + assert((client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listHotTabletsStream without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.descriptors.page.listHotTablets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listHotTabletsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.HotTablet) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHotTablets, request)); + assert.strictEqual( + (client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listHotTabletsStream with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listHotTablets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listHotTabletsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.HotTablet) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHotTablets, request)); + assert.strictEqual( + (client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHotTablets without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.descriptors.page.listHotTablets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; + const iterable = client.listHotTabletsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.ICreateClusterMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes createCluster with call error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateClusterRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.createCluster(request), expectedError); - assert( - (client.innerApiCalls.createCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes createCluster with LRO error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateClusterRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.createCluster(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes checkCreateClusterProgress without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkCreateClusterProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateClusterProgress with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkCreateClusterProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('updateCluster', () => { - it('invokes updateCluster without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.Cluster() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = - stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes updateCluster without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.Cluster() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCluster( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IUpdateClusterMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHotTablets with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listHotTablets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHotTabletsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IUpdateClusterMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes updateCluster with call error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.Cluster() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.updateCluster(request), expectedError); - assert( - (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes updateCluster with LRO error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.Cluster() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.updateCluster(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes checkUpdateClusterProgress without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkUpdateClusterProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateClusterProgress with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkUpdateClusterProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('partialUpdateCluster', () => { - it('invokes partialUpdateCluster without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest() - ); - request.cluster = {}; - request.cluster.name = ''; - const expectedHeaderRequestParams = 'cluster.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.partialUpdateCluster = - stubLongRunningCall(expectedResponse); - const [operation] = await client.partialUpdateCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.partialUpdateCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes partialUpdateCluster without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest() - ); - request.cluster = {}; - request.cluster.name = ''; - const expectedHeaderRequestParams = 'cluster.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.partialUpdateCluster = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.partialUpdateCluster( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IPartialUpdateClusterMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IPartialUpdateClusterMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.partialUpdateCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes partialUpdateCluster with call error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest() - ); - request.cluster = {}; - request.cluster.name = ''; - const expectedHeaderRequestParams = 'cluster.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.partialUpdateCluster = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.partialUpdateCluster(request), expectedError); - assert( - (client.innerApiCalls.partialUpdateCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes partialUpdateCluster with LRO error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest() - ); - request.cluster = {}; - request.cluster.name = ''; - const expectedHeaderRequestParams = 'cluster.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.partialUpdateCluster = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.partialUpdateCluster(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.partialUpdateCluster as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes checkPartialUpdateClusterProgress without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkPartialUpdateClusterProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPartialUpdateClusterProgress with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkPartialUpdateClusterProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('updateAppProfile', () => { - it('invokes updateAppProfile without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.UpdateAppProfileRequest() - ); - request.appProfile = {}; - request.appProfile.name = ''; - const expectedHeaderRequestParams = 'app_profile.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAppProfile = - stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAppProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes updateAppProfile without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.UpdateAppProfileRequest() - ); - request.appProfile = {}; - request.appProfile.name = ''; - const expectedHeaderRequestParams = 'app_profile.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAppProfile = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAppProfile( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IUpdateAppProfileMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IUpdateAppProfileMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes updateAppProfile with call error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.UpdateAppProfileRequest() - ); - request.appProfile = {}; - request.appProfile.name = ''; - const expectedHeaderRequestParams = 'app_profile.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAppProfile = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.updateAppProfile(request), expectedError); - assert( - (client.innerApiCalls.updateAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes updateAppProfile with LRO error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.UpdateAppProfileRequest() - ); - request.appProfile = {}; - request.appProfile.name = ''; - const expectedHeaderRequestParams = 'app_profile.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAppProfile = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.updateAppProfile(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.updateAppProfile as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes checkUpdateAppProfileProgress without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkUpdateAppProfileProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateAppProfileProgress with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkUpdateAppProfileProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('listAppProfiles', () => { - it('invokes listAppProfiles without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListAppProfilesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - ]; - client.innerApiCalls.listAppProfiles = stubSimpleCall(expectedResponse); - const [response] = await client.listAppProfiles(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listAppProfiles as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes listAppProfiles without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListAppProfilesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - ]; - client.innerApiCalls.listAppProfiles = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAppProfiles( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IAppProfile[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listAppProfiles as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes listAppProfiles with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListAppProfilesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listAppProfiles = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listAppProfiles(request), expectedError); - assert( - (client.innerApiCalls.listAppProfiles as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes listAppProfilesStream without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListAppProfilesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - ]; - client.descriptors.page.listAppProfiles.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listAppProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.AppProfile[] = []; - stream.on( - 'data', - (response: protos.google.bigtable.admin.v2.AppProfile) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listAppProfiles.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listAppProfiles, request) - ); - assert.strictEqual( - ( - client.descriptors.page.listAppProfiles.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listAppProfilesStream with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListAppProfilesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listAppProfiles.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listAppProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.AppProfile[] = []; - stream.on( - 'data', - (response: protos.google.bigtable.admin.v2.AppProfile) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listAppProfiles.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listAppProfiles, request) - ); - assert.strictEqual( - ( - client.descriptors.page.listAppProfiles.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAppProfiles without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListAppProfilesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - ]; - client.descriptors.page.listAppProfiles.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.IAppProfile[] = []; - const iterable = client.listAppProfilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listAppProfiles.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert.strictEqual( - ( - client.descriptors.page.listAppProfiles.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAppProfiles with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListAppProfilesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listAppProfiles.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAppProfilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.IAppProfile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listAppProfiles.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert.strictEqual( - ( - client.descriptors.page.listAppProfiles.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listHotTablets', () => { - it('invokes listHotTablets without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListHotTabletsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - ]; - client.innerApiCalls.listHotTablets = stubSimpleCall(expectedResponse); - const [response] = await client.listHotTablets(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listHotTablets as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes listHotTablets without error using callback', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListHotTabletsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - ]; - client.innerApiCalls.listHotTablets = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listHotTablets( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IHotTablet[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listHotTablets as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes listHotTablets with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListHotTabletsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listHotTablets = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listHotTablets(request), expectedError); - assert( - (client.innerApiCalls.listHotTablets as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes listHotTabletsStream without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListHotTabletsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - ]; - client.descriptors.page.listHotTablets.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listHotTabletsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; - stream.on( - 'data', - (response: protos.google.bigtable.admin.v2.HotTablet) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listHotTablets.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listHotTablets, request) - ); - assert.strictEqual( - ( - client.descriptors.page.listHotTablets.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listHotTabletsStream with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListHotTabletsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listHotTablets.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listHotTabletsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; - stream.on( - 'data', - (response: protos.google.bigtable.admin.v2.HotTablet) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listHotTablets.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listHotTablets, request) - ); - assert.strictEqual( - ( - client.descriptors.page.listHotTablets.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listHotTablets without error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListHotTabletsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - ]; - client.descriptors.page.listHotTablets.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; - const iterable = client.listHotTabletsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listHotTablets.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert.strictEqual( - ( - client.descriptors.page.listHotTablets.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listHotTablets with error', async () => { - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListHotTabletsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listHotTablets.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listHotTabletsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listHotTablets.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert.strictEqual( - ( - client.descriptors.page.listHotTablets.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - describe('appProfile', () => { - const fakePath = '/rendered/path/appProfile'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - app_profile: 'appProfileValue', - }; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.appProfilePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.appProfilePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('appProfilePath', () => { - const result = client.appProfilePath( - 'projectValue', - 'instanceValue', - 'appProfileValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.appProfilePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromAppProfileName', () => { - const result = client.matchProjectFromAppProfileName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromAppProfileName', () => { - const result = client.matchInstanceFromAppProfileName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchAppProfileFromAppProfileName', () => { - const result = client.matchAppProfileFromAppProfileName(fakePath); - assert.strictEqual(result, 'appProfileValue'); - assert( - (client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('backup', () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - cluster: 'clusterValue', - backup: 'backupValue', - }; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath( - 'projectValue', - 'instanceValue', - 'clusterValue', - 'backupValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromBackupName', () => { - const result = client.matchInstanceFromBackupName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchClusterFromBackupName', () => { - const result = client.matchClusterFromBackupName(fakePath); - assert.strictEqual(result, 'clusterValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('cluster', () => { - const fakePath = '/rendered/path/cluster'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - cluster: 'clusterValue', - }; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.clusterPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath( - 'projectValue', - 'instanceValue', - 'clusterValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromClusterName', () => { - const result = client.matchInstanceFromClusterName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, 'clusterValue'); - assert( - (client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('hotTablet', () => { - const fakePath = '/rendered/path/hotTablet'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - cluster: 'clusterValue', - hot_tablet: 'hotTabletValue', - }; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hotTabletPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.hotTabletPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('hotTabletPath', () => { - const result = client.hotTabletPath( - 'projectValue', - 'instanceValue', - 'clusterValue', - 'hotTabletValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.hotTabletPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromHotTabletName', () => { - const result = client.matchProjectFromHotTabletName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromHotTabletName', () => { - const result = client.matchInstanceFromHotTabletName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchClusterFromHotTabletName', () => { - const result = client.matchClusterFromHotTabletName(fakePath); - assert.strictEqual(result, 'clusterValue'); - assert( - (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchHotTabletFromHotTabletName', () => { - const result = client.matchHotTabletFromHotTabletName(fakePath); - assert.strictEqual(result, 'hotTabletValue'); - assert( - (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('instance', () => { - const fakePath = '/rendered/path/instance'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - }; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.instancePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath('projectValue', 'instanceValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('project', () => { - const fakePath = '/rendered/path/project'; - const expectedParameters = { - project: 'projectValue', - }; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.projectPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath('projectValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('snapshot', () => { - const fakePath = '/rendered/path/snapshot'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - cluster: 'clusterValue', - snapshot: 'snapshotValue', - }; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.snapshotPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.snapshotPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('snapshotPath', () => { - const result = client.snapshotPath( - 'projectValue', - 'instanceValue', - 'clusterValue', - 'snapshotValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.snapshotPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromSnapshotName', () => { - const result = client.matchProjectFromSnapshotName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromSnapshotName', () => { - const result = client.matchInstanceFromSnapshotName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchClusterFromSnapshotName', () => { - const result = client.matchClusterFromSnapshotName(fakePath); - assert.strictEqual(result, 'clusterValue'); - assert( - (client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchSnapshotFromSnapshotName', () => { - const result = client.matchSnapshotFromSnapshotName(fakePath); - assert.strictEqual(result, 'snapshotValue'); - assert( - (client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('table', () => { - const fakePath = '/rendered/path/table'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - table: 'tableValue', - }; - const client = - new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tablePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.tablePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('tablePath', () => { - const result = client.tablePath( - 'projectValue', - 'instanceValue', - 'tableValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.tablePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromTableName', () => { - const result = client.matchProjectFromTableName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromTableName', () => { - const result = client.matchInstanceFromTableName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchTableFromTableName', () => { - const result = client.matchTableFromTableName(fakePath); - assert.strictEqual(result, 'tableValue'); - assert( - (client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('appProfile', () => { + const fakePath = "/rendered/path/appProfile"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + app_profile: "appProfileValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.appProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.appProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('appProfilePath', () => { + const result = client.appProfilePath("projectValue", "instanceValue", "appProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.appProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAppProfileName', () => { + const result = client.matchProjectFromAppProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromAppProfileName', () => { + const result = client.matchInstanceFromAppProfileName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAppProfileFromAppProfileName', () => { + const result = client.matchAppProfileFromAppProfileName(fakePath); + assert.strictEqual(result, "appProfileValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + backup: "backupValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "instanceValue", "clusterValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromBackupName', () => { + const result = client.matchInstanceFromBackupName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromBackupName', () => { + const result = client.matchClusterFromBackupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cluster', () => { + const fakePath = "/rendered/path/cluster"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.clusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath("projectValue", "instanceValue", "clusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromClusterName', () => { + const result = client.matchInstanceFromClusterName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('hotTablet', () => { + const fakePath = "/rendered/path/hotTablet"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + hot_tablet: "hotTabletValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hotTabletPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.hotTabletPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('hotTabletPath', () => { + const result = client.hotTabletPath("projectValue", "instanceValue", "clusterValue", "hotTabletValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.hotTabletPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromHotTabletName', () => { + const result = client.matchProjectFromHotTabletName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromHotTabletName', () => { + const result = client.matchInstanceFromHotTabletName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromHotTabletName', () => { + const result = client.matchClusterFromHotTabletName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchHotTabletFromHotTabletName', () => { + const result = client.matchHotTabletFromHotTabletName(fakePath); + assert.strictEqual(result, "hotTabletValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('snapshot', () => { + const fakePath = "/rendered/path/snapshot"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + snapshot: "snapshotValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.snapshotPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.snapshotPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('snapshotPath', () => { + const result = client.snapshotPath("projectValue", "instanceValue", "clusterValue", "snapshotValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.snapshotPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSnapshotName', () => { + const result = client.matchProjectFromSnapshotName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromSnapshotName', () => { + const result = client.matchInstanceFromSnapshotName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromSnapshotName', () => { + const result = client.matchClusterFromSnapshotName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSnapshotFromSnapshotName', () => { + const result = client.matchSnapshotFromSnapshotName(fakePath); + assert.strictEqual(result, "snapshotValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('table', () => { + const fakePath = "/rendered/path/table"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + table: "tableValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tablePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tablePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tablePath', () => { + const result = client.tablePath("projectValue", "instanceValue", "tableValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tablePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTableName', () => { + const result = client.matchProjectFromTableName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromTableName', () => { + const result = client.matchInstanceFromTableName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTableFromTableName', () => { + const result = client.matchTableFromTableName(fakePath); + assert.strictEqual(result, "tableValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); }); - }); }); diff --git a/test/gapic_bigtable_table_admin_v2.ts b/test/gapic_bigtable_table_admin_v2.ts index 370dedcda..9ea587fee 100644 --- a/test/gapic_bigtable_table_admin_v2.ts +++ b/test/gapic_bigtable_table_admin_v2.ts @@ -20,4210 +20,3931 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { describe, it } from 'mocha'; import * as bigtabletableadminModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall( - responses?: ResponseType[], - error?: Error -) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } } - } - const transformStub = error - ? sinon.stub().callsArgWith(2, error) - : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { - mockStream.write({}); - }); + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); } describe('v2.BigtableTableAdminClient', () => { - it('has servicePath', () => { - const servicePath = - bigtabletableadminModule.v2.BigtableTableAdminClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - bigtabletableadminModule.v2.BigtableTableAdminClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = bigtabletableadminModule.v2.BigtableTableAdminClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - fallback: true, + it('has servicePath', () => { + const servicePath = bigtabletableadminModule.v2.BigtableTableAdminClient.servicePath; + assert(servicePath); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableTableAdminStub, undefined); - await client.initialize(); - assert(client.bigtableTableAdminStub); - }); - - it('has close method for the initialized client', done => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has apiEndpoint', () => { + const apiEndpoint = bigtabletableadminModule.v2.BigtableTableAdminClient.apiEndpoint; + assert(apiEndpoint); }); - client.initialize(); - assert(client.bigtableTableAdminStub); - client.close().then(() => { - done(); - }); - }); - it('has close method for the non-initialized client', done => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableTableAdminStub, undefined); - client.close().then(() => { - done(); + it('has port', () => { + const port = bigtabletableadminModule.v2.BigtableTableAdminClient.port; + assert(port); + assert(typeof port === 'number'); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('createTable', () => { - it('invokes createTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateTableRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Table() - ); - client.innerApiCalls.createTable = stubSimpleCall(expectedResponse); - const [response] = await client.createTable(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('should create a client with no option', () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient(); + assert(client); }); - it('invokes createTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateTableRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Table() - ); - client.innerApiCalls.createTable = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTable( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.ITable | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('should create a client with gRPC fallback', () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + fallback: true, + }); + assert(client); }); - it('invokes createTable with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateTableRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createTable = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createTable(request), expectedError); - assert( - (client.innerApiCalls.createTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has initialize method and supports deferred initialization', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableTableAdminStub, undefined); + await client.initialize(); + assert(client.bigtableTableAdminStub); }); - it('invokes createTable with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateTableRequest() - ); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createTable(request), expectedError); - }); - }); - - describe('getTable', () => { - it('invokes getTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Table() - ); - client.innerApiCalls.getTable = stubSimpleCall(expectedResponse); - const [response] = await client.getTable(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has close method for the initialized client', done => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.bigtableTableAdminStub); + client.close().then(() => { + done(); + }); }); - it('invokes getTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Table() - ); - client.innerApiCalls.getTable = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTable( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.ITable | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('has close method for the non-initialized client', done => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableTableAdminStub, undefined); + client.close().then(() => { + done(); + }); }); - it('invokes getTable with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTable(request), expectedError); - assert( - (client.innerApiCalls.getTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - it('invokes getTable with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetTableRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getTable(request), expectedError); - }); - }); - - describe('deleteTable', () => { - it('invokes deleteTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTable = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTable(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - it('invokes deleteTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTable = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTable( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + describe('createTable', () => { + it('invokes createTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.createTable = stubSimpleCall(expectedResponse); + const [response] = await client.createTable(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes deleteTable with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTable = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteTable(request), expectedError); - assert( - (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes createTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.createTable = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTable( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes deleteTable with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteTableRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteTable(request), expectedError); - }); - }); - - describe('modifyColumnFamilies', () => { - it('invokes modifyColumnFamilies without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Table() - ); - client.innerApiCalls.modifyColumnFamilies = - stubSimpleCall(expectedResponse); - const [response] = await client.modifyColumnFamilies(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.modifyColumnFamilies as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes createTable with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTable = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createTable(request), expectedError); + assert((client.innerApiCalls.createTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes modifyColumnFamilies without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Table() - ); - client.innerApiCalls.modifyColumnFamilies = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.modifyColumnFamilies( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.ITable | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.modifyColumnFamilies as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('invokes createTable with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createTable(request), expectedError); + }); }); - it('invokes modifyColumnFamilies with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.modifyColumnFamilies = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.modifyColumnFamilies(request), expectedError); - assert( - (client.innerApiCalls.modifyColumnFamilies as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('getTable', () => { + it('invokes getTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.getTable = stubSimpleCall(expectedResponse); + const [response] = await client.getTable(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes modifyColumnFamilies with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.modifyColumnFamilies(request), expectedError); - }); - }); - - describe('dropRowRange', () => { - it('invokes dropRowRange without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DropRowRangeRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.dropRowRange = stubSimpleCall(expectedResponse); - const [response] = await client.dropRowRange(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.dropRowRange as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes getTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.getTable = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTable( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes dropRowRange without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DropRowRangeRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.dropRowRange = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.dropRowRange( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.dropRowRange as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + it('invokes getTable with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getTable = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTable(request), expectedError); + assert((client.innerApiCalls.getTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes dropRowRange with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DropRowRangeRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.dropRowRange = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.dropRowRange(request), expectedError); - assert( - (client.innerApiCalls.dropRowRange as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes getTable with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getTable(request), expectedError); + }); }); - it('invokes dropRowRange with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DropRowRangeRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.dropRowRange(request), expectedError); - }); - }); - - describe('generateConsistencyToken', () => { - it('invokes generateConsistencyToken without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.GenerateConsistencyTokenResponse() - ); - client.innerApiCalls.generateConsistencyToken = - stubSimpleCall(expectedResponse); - const [response] = await client.generateConsistencyToken(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateConsistencyToken as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('deleteTable', () => { + it('invokes deleteTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTable = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTable(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes generateConsistencyToken without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.GenerateConsistencyTokenResponse() - ); - client.innerApiCalls.generateConsistencyToken = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateConsistencyToken( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateConsistencyToken as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + it('invokes deleteTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTable = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTable( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes generateConsistencyToken with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.generateConsistencyToken = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.generateConsistencyToken(request), - expectedError - ); - assert( - (client.innerApiCalls.generateConsistencyToken as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes deleteTable with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTable = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteTable(request), expectedError); + assert((client.innerApiCalls.deleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes generateConsistencyToken with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects( - client.generateConsistencyToken(request), - expectedError - ); - }); - }); - - describe('checkConsistency', () => { - it('invokes checkConsistency without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CheckConsistencyRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.CheckConsistencyResponse() - ); - client.innerApiCalls.checkConsistency = stubSimpleCall(expectedResponse); - const [response] = await client.checkConsistency(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.checkConsistency as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes deleteTable with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteTable(request), expectedError); + }); }); - it('invokes checkConsistency without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CheckConsistencyRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.CheckConsistencyResponse() - ); - client.innerApiCalls.checkConsistency = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.checkConsistency( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.ICheckConsistencyResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.checkConsistency as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + describe('modifyColumnFamilies', () => { + it('invokes modifyColumnFamilies without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.modifyColumnFamilies = stubSimpleCall(expectedResponse); + const [response] = await client.modifyColumnFamilies(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.modifyColumnFamilies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes checkConsistency with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CheckConsistencyRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.checkConsistency = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.checkConsistency(request), expectedError); - assert( - (client.innerApiCalls.checkConsistency as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes modifyColumnFamilies without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.modifyColumnFamilies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.modifyColumnFamilies( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.modifyColumnFamilies as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes checkConsistency with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CheckConsistencyRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.checkConsistency(request), expectedError); - }); - }); - - describe('getSnapshot', () => { - it('invokes getSnapshot without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetSnapshotRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Snapshot() - ); - client.innerApiCalls.getSnapshot = stubSimpleCall(expectedResponse); - const [response] = await client.getSnapshot(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes modifyColumnFamilies with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.modifyColumnFamilies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.modifyColumnFamilies(request), expectedError); + assert((client.innerApiCalls.modifyColumnFamilies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes getSnapshot without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetSnapshotRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Snapshot() - ); - client.innerApiCalls.getSnapshot = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSnapshot( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.ISnapshot | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('invokes modifyColumnFamilies with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.modifyColumnFamilies(request), expectedError); + }); }); - it('invokes getSnapshot with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetSnapshotRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSnapshot = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getSnapshot(request), expectedError); - assert( - (client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('dropRowRange', () => { + it('invokes dropRowRange without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.dropRowRange = stubSimpleCall(expectedResponse); + const [response] = await client.dropRowRange(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.dropRowRange as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes getSnapshot with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetSnapshotRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSnapshot(request), expectedError); - }); - }); - - describe('deleteSnapshot', () => { - it('invokes deleteSnapshot without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteSnapshotRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSnapshot = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSnapshot(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes dropRowRange without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.dropRowRange = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.dropRowRange( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.dropRowRange as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes deleteSnapshot without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteSnapshotRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSnapshot = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSnapshot( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + it('invokes dropRowRange with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.dropRowRange = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.dropRowRange(request), expectedError); + assert((client.innerApiCalls.dropRowRange as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes deleteSnapshot with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteSnapshotRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSnapshot = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteSnapshot(request), expectedError); - assert( - (client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes dropRowRange with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.dropRowRange(request), expectedError); + }); }); - it('invokes deleteSnapshot with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteSnapshotRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSnapshot(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetBackupRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('generateConsistencyToken', () => { + it('invokes generateConsistencyToken without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenResponse()); + client.innerApiCalls.generateConsistencyToken = stubSimpleCall(expectedResponse); + const [response] = await client.generateConsistencyToken(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.generateConsistencyToken as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes getBackup without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetBackupRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Backup() - ); - client.innerApiCalls.getBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IBackup | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + it('invokes generateConsistencyToken without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenResponse()); + client.innerApiCalls.generateConsistencyToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateConsistencyToken( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.generateConsistencyToken as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes getBackup with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetBackupRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - assert( - (client.innerApiCalls.getBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes generateConsistencyToken with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateConsistencyToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateConsistencyToken(request), expectedError); + assert((client.innerApiCalls.generateConsistencyToken as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes getBackup with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.GetBackupRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('updateBackup', () => { - it('invokes updateBackup without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.UpdateBackupRequest() - ); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = 'backup.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Backup() - ); - client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); - const [response] = await client.updateBackup(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes generateConsistencyToken with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateConsistencyToken(request), expectedError); + }); }); - it('invokes updateBackup without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.UpdateBackupRequest() - ); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = 'backup.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.bigtable.admin.v2.Backup() - ); - client.innerApiCalls.updateBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackup( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IBackup | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + describe('checkConsistency', () => { + it('invokes checkConsistency without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyResponse()); + client.innerApiCalls.checkConsistency = stubSimpleCall(expectedResponse); + const [response] = await client.checkConsistency(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.checkConsistency as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes updateBackup with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.UpdateBackupRequest() - ); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = 'backup.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.updateBackup(request), expectedError); - assert( - (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes checkConsistency without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyResponse()); + client.innerApiCalls.checkConsistency = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.checkConsistency( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ICheckConsistencyResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.checkConsistency as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes updateBackup with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.UpdateBackupRequest() - ); - request.backup = {}; - request.backup.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateBackup(request), expectedError); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteBackupRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBackup(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes checkConsistency with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.checkConsistency = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkConsistency(request), expectedError); + assert((client.innerApiCalls.checkConsistency as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes deleteBackup without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteBackupRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('invokes checkConsistency with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.checkConsistency(request), expectedError); + }); }); - it('invokes deleteBackup with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteBackupRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteBackup(request), expectedError); - assert( - (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('getSnapshot', () => { + it('invokes getSnapshot without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()); + client.innerApiCalls.getSnapshot = stubSimpleCall(expectedResponse); + const [response] = await client.getSnapshot(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes deleteBackup with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.DeleteBackupRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteBackup(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes getSnapshot without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()); + client.innerApiCalls.getSnapshot = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSnapshot( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ISnapshot|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - ( - err?: Error | null, - result?: protos.google.iam.v1.IPolicy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + it('invokes getSnapshot with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSnapshot = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSnapshot(request), expectedError); + assert((client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes getIamPolicy with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getIamPolicy(request), expectedError); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes getSnapshot with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSnapshot(request), expectedError); + }); }); - it('invokes getIamPolicy with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('deleteSnapshot', () => { + it('invokes deleteSnapshot without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSnapshot = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSnapshot(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - ( - err?: Error | null, - result?: protos.google.iam.v1.IPolicy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + it('invokes deleteSnapshot without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSnapshot = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSnapshot( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes setIamPolicy with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.setIamPolicy(request), expectedError); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes deleteSnapshot with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSnapshot = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSnapshot(request), expectedError); + assert((client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes setIamPolicy with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = - stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes deleteSnapshot with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSnapshot(request), expectedError); + }); }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - ( - err?: Error | null, - result?: protos.google.iam.v1.ITestIamPermissionsResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes testIamPermissions with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.testIamPermissions(request), expectedError); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes getBackup without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes testIamPermissions with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('createTableFromSnapshot', () => { - it('invokes createTableFromSnapshot without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createTableFromSnapshot = - stubLongRunningCall(expectedResponse); - const [operation] = await client.createTableFromSnapshot(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createTableFromSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes getBackup with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes createTableFromSnapshot without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createTableFromSnapshot = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTableFromSnapshot( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableFromSnapshotMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableFromSnapshotMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createTableFromSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('invokes getBackup with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); }); - it('invokes createTableFromSnapshot with call error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.createTableFromSnapshot(request), - expectedError - ); - assert( - (client.innerApiCalls.createTableFromSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('updateBackup', () => { + it('invokes updateBackup without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); + client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); + const [response] = await client.updateBackup(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes createTableFromSnapshot with LRO error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.createTableFromSnapshot(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createTableFromSnapshot as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes updateBackup without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); + client.innerApiCalls.updateBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackup( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes checkCreateTableFromSnapshotProgress without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkCreateTableFromSnapshotProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateBackup with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBackup(request), expectedError); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes checkCreateTableFromSnapshotProgress with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkCreateTableFromSnapshotProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('snapshotTable', () => { - it('invokes snapshotTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.SnapshotTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.snapshotTable = - stubLongRunningCall(expectedResponse); - const [operation] = await client.snapshotTable(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.snapshotTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes updateBackup with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBackup(request), expectedError); + }); }); - it('invokes snapshotTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.SnapshotTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.snapshotTable = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.snapshotTable( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.ISnapshotTableMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.ISnapshotTableMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.snapshotTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBackup(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes snapshotTable with call error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.SnapshotTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.snapshotTable = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.snapshotTable(request), expectedError); - assert( - (client.innerApiCalls.snapshotTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes deleteBackup without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes snapshotTable with LRO error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.SnapshotTableRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.snapshotTable = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.snapshotTable(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.snapshotTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes deleteBackup with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes checkSnapshotTableProgress without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkSnapshotTableProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + it('invokes deleteBackup with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBackup(request), expectedError); + }); }); - it('invokes checkSnapshotTableProgress with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkSnapshotTableProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateBackupRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes createBackup without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateBackupRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.ICreateBackupMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.ICreateBackupMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes createBackup with call error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateBackupRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.createBackup(request), expectedError); - assert( - (client.innerApiCalls.createBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes getIamPolicy with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes createBackup with LRO error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.CreateBackupRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createBackup as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes getIamPolicy with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); }); - it('invokes checkCreateBackupProgress without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkCreateBackupProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes checkCreateBackupProgress with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + it('invokes setIamPolicy with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); }); - }); - - describe('restoreTable', () => { - it('invokes restoreTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.RestoreTableRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreTable = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreTable(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.restoreTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); }); - it('invokes restoreTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.RestoreTableRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreTable = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreTable( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IRestoreTableMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IRestoreTableMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.restoreTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + describe('createTableFromSnapshot', () => { + it('invokes createTableFromSnapshot without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall(expectedResponse); + const [operation] = await client.createTableFromSnapshot(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTableFromSnapshot without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createTableFromSnapshot = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTableFromSnapshot( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createTableFromSnapshot with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createTableFromSnapshot(request), expectedError); + assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTableFromSnapshot with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createTableFromSnapshot(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateTableFromSnapshotProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCreateTableFromSnapshotProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateTableFromSnapshotProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCreateTableFromSnapshotProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - it('invokes restoreTable with call error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.RestoreTableRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreTable = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.restoreTable(request), expectedError); - assert( - (client.innerApiCalls.restoreTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + describe('undeleteTable', () => { + it('invokes undeleteTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UndeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.undeleteTable = stubLongRunningCall(expectedResponse); + const [operation] = await client.undeleteTable(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.undeleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes undeleteTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UndeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.undeleteTable = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeleteTable( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.undeleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes undeleteTable with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UndeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeleteTable = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.undeleteTable(request), expectedError); + assert((client.innerApiCalls.undeleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes undeleteTable with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UndeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeleteTable = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.undeleteTable(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.undeleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUndeleteTableProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkUndeleteTableProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUndeleteTableProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkUndeleteTableProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - it('invokes restoreTable with LRO error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.RestoreTableRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreTable = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.restoreTable(request); - await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.restoreTable as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + describe('snapshotTable', () => { + it('invokes snapshotTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.snapshotTable = stubLongRunningCall(expectedResponse); + const [operation] = await client.snapshotTable(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.snapshotTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes snapshotTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.snapshotTable = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.snapshotTable( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.snapshotTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes snapshotTable with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.snapshotTable = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.snapshotTable(request), expectedError); + assert((client.innerApiCalls.snapshotTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes snapshotTable with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.snapshotTable = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.snapshotTable(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.snapshotTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkSnapshotTableProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkSnapshotTableProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSnapshotTableProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkSnapshotTableProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - it('invokes checkRestoreTableProgress without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkRestoreTableProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createBackup with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - it('invokes checkRestoreTableProgress with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkRestoreTableProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + describe('restoreTable', () => { + it('invokes restoreTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreTable = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreTable(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreTable = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreTable( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes restoreTable with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreTable = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreTable(request), expectedError); + assert((client.innerApiCalls.restoreTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreTable with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreTable = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreTable(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.restoreTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRestoreTableProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkRestoreTableProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreTableProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkRestoreTableProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - }); - - describe('listTables', () => { - it('invokes listTables without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListTablesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - ]; - client.innerApiCalls.listTables = stubSimpleCall(expectedResponse); - const [response] = await client.listTables(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listTables as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + + describe('copyBackup', () => { + it('invokes copyBackup without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CopyBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.copyBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.copyBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.copyBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes copyBackup without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CopyBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.copyBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.copyBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.copyBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes copyBackup with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CopyBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.copyBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.copyBackup(request), expectedError); + assert((client.innerApiCalls.copyBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes copyBackup with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CopyBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.copyBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.copyBackup(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.copyBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCopyBackupProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCopyBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCopyBackupProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCopyBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); }); - it('invokes listTables without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListTablesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - ]; - client.innerApiCalls.listTables = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTables( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.ITable[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); + describe('listTables', () => { + it('invokes listTables without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + ]; + client.innerApiCalls.listTables = stubSimpleCall(expectedResponse); + const [response] = await client.listTables(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTables as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTables without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + ]; + client.innerApiCalls.listTables = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTables( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTables as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listTables with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listTables = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTables(request), expectedError); + assert((client.innerApiCalls.listTables as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTablesStream without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + ]; + client.descriptors.page.listTables.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTablesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Table[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Table) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listTables.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTables, request)); + assert.strictEqual( + (client.descriptors.page.listTables.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listTablesStream with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listTables.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTablesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Table[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Table) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTables.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTables, request)); + assert.strictEqual( + (client.descriptors.page.listTables.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTables without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + ]; + client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.ITable[] = []; + const iterable = client.listTablesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listTables as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTables.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTables.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); - it('invokes listTables with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListTablesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listTables = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listTables(request), expectedError); - assert( - (client.innerApiCalls.listTables as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('uses async iteration with listTables with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTablesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.ITable[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTables.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTables.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); }); - it('invokes listTablesStream without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListTablesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - ]; - client.descriptors.page.listTables.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listTablesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Table[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.Table) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listTables, request) - ); - assert.strictEqual( - (client.descriptors.page.listTables.createStream as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); + describe('listSnapshots', () => { + it('invokes listSnapshots without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + ]; + client.innerApiCalls.listSnapshots = stubSimpleCall(expectedResponse); + const [response] = await client.listSnapshots(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes listTablesStream with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListTablesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listTables.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listTablesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Table[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.Table) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listTables, request) - ); - assert.strictEqual( - (client.descriptors.page.listTables.createStream as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); + it('invokes listSnapshots without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + ]; + client.innerApiCalls.listSnapshots = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSnapshots( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ISnapshot[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('uses async iteration with listTables without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListTablesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - ]; - client.descriptors.page.listTables.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.ITable[] = []; - const iterable = client.listTablesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub).getCall( - 0 - ).args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); + it('invokes listSnapshots with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSnapshots = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSnapshots(request), expectedError); + assert((client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('uses async iteration with listTables with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListTablesRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); - const iterable = client.listTablesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.ITable[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub).getCall( - 0 - ).args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listSnapshots', () => { - it('invokes listSnapshots without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListSnapshotsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - ]; - client.innerApiCalls.listSnapshots = stubSimpleCall(expectedResponse); - const [response] = await client.listSnapshots(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes listSnapshotsStream without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + ]; + client.descriptors.page.listSnapshots.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSnapshotsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Snapshot[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Snapshot) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSnapshots.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSnapshots, request)); + assert.strictEqual( + (client.descriptors.page.listSnapshots.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); - it('invokes listSnapshots without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListSnapshotsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - ]; - client.innerApiCalls.listSnapshots = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSnapshots( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.ISnapshot[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); + it('invokes listSnapshotsStream with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSnapshots.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSnapshotsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Snapshot[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Snapshot) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSnapshots.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSnapshots, request)); + assert.strictEqual( + (client.descriptors.page.listSnapshots.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSnapshots without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + ]; + client.descriptors.page.listSnapshots.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.ISnapshot[] = []; + const iterable = client.listSnapshotsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); - it('invokes listSnapshots with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListSnapshotsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSnapshots = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listSnapshots(request), expectedError); - assert( - (client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('uses async iteration with listSnapshots with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSnapshots.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSnapshotsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.ISnapshot[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); }); - it('invokes listSnapshotsStream without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListSnapshotsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - ]; - client.descriptors.page.listSnapshots.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listSnapshotsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Snapshot[] = []; - stream.on( - 'data', - (response: protos.google.bigtable.admin.v2.Snapshot) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listSnapshots.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listSnapshots, request) - ); - assert.strictEqual( - ( - client.descriptors.page.listSnapshots.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes listSnapshotsStream with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListSnapshotsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listSnapshots.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listSnapshotsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Snapshot[] = []; - stream.on( - 'data', - (response: protos.google.bigtable.admin.v2.Snapshot) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listSnapshots.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listSnapshots, request) - ); - assert.strictEqual( - ( - client.descriptors.page.listSnapshots.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); + it('invokes listBackups without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('uses async iteration with listSnapshots without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListSnapshotsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - ]; - client.descriptors.page.listSnapshots.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.ISnapshot[] = []; - const iterable = client.listSnapshotsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listSnapshots.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert.strictEqual( - ( - client.descriptors.page.listSnapshots.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); + it('invokes listBackups with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('uses async iteration with listSnapshots with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListSnapshotsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listSnapshots.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSnapshotsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.ISnapshot[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listSnapshots.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert.strictEqual( - ( - client.descriptors.page.listSnapshots.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListBackupsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listBackups as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes listBackupsStream without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Backup[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert.strictEqual( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Backup[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert.strictEqual( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); - it('invokes listBackups without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListBackupsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - ]; - client.innerApiCalls.listBackups = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - ( - err?: Error | null, - result?: protos.google.bigtable.admin.v2.IBackup[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); + it('uses async iteration with listBackups without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listBackups as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); - it('invokes listBackups with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListBackupsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listBackups(request), expectedError); - assert( - (client.innerApiCalls.listBackups as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('uses async iteration with listBackups with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); }); - - it('invokes listBackupsStream without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListBackupsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - ]; - client.descriptors.page.listBackups.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Backup[] = []; - stream.on( - 'data', - (response: protos.google.bigtable.admin.v2.Backup) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listBackups, request) - ); - assert.strictEqual( - (client.descriptors.page.listBackups.createStream as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); }); - - it('invokes listBackupsStream with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListBackupsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Backup[] = []; - stream.on( - 'data', - (response: protos.google.bigtable.admin.v2.Backup) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listBackups, request) - ); - assert.strictEqual( - (client.descriptors.page.listBackups.createStream as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); }); - - it('uses async iteration with listBackups without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListBackupsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0 - ).args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); }); - - it('uses async iteration with listBackups with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.bigtable.admin.v2.ListBackupsRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0 - ).args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); }); - }); - - describe('Path templates', () => { - describe('appProfile', () => { - const fakePath = '/rendered/path/appProfile'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - app_profile: 'appProfileValue', - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.appProfilePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.appProfilePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('appProfilePath', () => { - const result = client.appProfilePath( - 'projectValue', - 'instanceValue', - 'appProfileValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.appProfilePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromAppProfileName', () => { - const result = client.matchProjectFromAppProfileName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromAppProfileName', () => { - const result = client.matchInstanceFromAppProfileName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchAppProfileFromAppProfileName', () => { - const result = client.matchAppProfileFromAppProfileName(fakePath); - assert.strictEqual(result, 'appProfileValue'); - assert( - (client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); }); - - describe('backup', () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - cluster: 'clusterValue', - backup: 'backupValue', - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath( - 'projectValue', - 'instanceValue', - 'clusterValue', - 'backupValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromBackupName', () => { - const result = client.matchInstanceFromBackupName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchClusterFromBackupName', () => { - const result = client.matchClusterFromBackupName(fakePath); - assert.strictEqual(result, 'clusterValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); }); - describe('cluster', () => { - const fakePath = '/rendered/path/cluster'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - cluster: 'clusterValue', - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.clusterPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath( - 'projectValue', - 'instanceValue', - 'clusterValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromClusterName', () => { - const result = client.matchInstanceFromClusterName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, 'clusterValue'); - assert( - (client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); + describe('Path templates', () => { + + describe('appProfile', () => { + const fakePath = "/rendered/path/appProfile"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + app_profile: "appProfileValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.appProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.appProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('appProfilePath', () => { + const result = client.appProfilePath("projectValue", "instanceValue", "appProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.appProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAppProfileName', () => { + const result = client.matchProjectFromAppProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromAppProfileName', () => { + const result = client.matchInstanceFromAppProfileName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAppProfileFromAppProfileName', () => { + const result = client.matchAppProfileFromAppProfileName(fakePath); + assert.strictEqual(result, "appProfileValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); - describe('hotTablet', () => { - const fakePath = '/rendered/path/hotTablet'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - cluster: 'clusterValue', - hot_tablet: 'hotTabletValue', - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hotTabletPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.hotTabletPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('hotTabletPath', () => { - const result = client.hotTabletPath( - 'projectValue', - 'instanceValue', - 'clusterValue', - 'hotTabletValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.hotTabletPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromHotTabletName', () => { - const result = client.matchProjectFromHotTabletName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromHotTabletName', () => { - const result = client.matchInstanceFromHotTabletName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchClusterFromHotTabletName', () => { - const result = client.matchClusterFromHotTabletName(fakePath); - assert.strictEqual(result, 'clusterValue'); - assert( - (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchHotTabletFromHotTabletName', () => { - const result = client.matchHotTabletFromHotTabletName(fakePath); - assert.strictEqual(result, 'hotTabletValue'); - assert( - (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + backup: "backupValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "instanceValue", "clusterValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromBackupName', () => { + const result = client.matchInstanceFromBackupName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromBackupName', () => { + const result = client.matchClusterFromBackupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); - describe('instance', () => { - const fakePath = '/rendered/path/instance'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.instancePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath('projectValue', 'instanceValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); + describe('cluster', () => { + const fakePath = "/rendered/path/cluster"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.clusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath("projectValue", "instanceValue", "clusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromClusterName', () => { + const result = client.matchInstanceFromClusterName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); - describe('snapshot', () => { - const fakePath = '/rendered/path/snapshot'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - cluster: 'clusterValue', - snapshot: 'snapshotValue', - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.snapshotPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.snapshotPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('snapshotPath', () => { - const result = client.snapshotPath( - 'projectValue', - 'instanceValue', - 'clusterValue', - 'snapshotValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.snapshotPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromSnapshotName', () => { - const result = client.matchProjectFromSnapshotName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromSnapshotName', () => { - const result = client.matchInstanceFromSnapshotName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchClusterFromSnapshotName', () => { - const result = client.matchClusterFromSnapshotName(fakePath); - assert.strictEqual(result, 'clusterValue'); - assert( - (client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchSnapshotFromSnapshotName', () => { - const result = client.matchSnapshotFromSnapshotName(fakePath); - assert.strictEqual(result, 'snapshotValue'); - assert( - (client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); + describe('hotTablet', () => { + const fakePath = "/rendered/path/hotTablet"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + hot_tablet: "hotTabletValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hotTabletPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.hotTabletPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('hotTabletPath', () => { + const result = client.hotTabletPath("projectValue", "instanceValue", "clusterValue", "hotTabletValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.hotTabletPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromHotTabletName', () => { + const result = client.matchProjectFromHotTabletName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromHotTabletName', () => { + const result = client.matchInstanceFromHotTabletName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromHotTabletName', () => { + const result = client.matchClusterFromHotTabletName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchHotTabletFromHotTabletName', () => { + const result = client.matchHotTabletFromHotTabletName(fakePath); + assert.strictEqual(result, "hotTabletValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); - describe('table', () => { - const fakePath = '/rendered/path/table'; - const expectedParameters = { - project: 'projectValue', - instance: 'instanceValue', - table: 'tableValue', - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tablePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.tablePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('tablePath', () => { - const result = client.tablePath( - 'projectValue', - 'instanceValue', - 'tableValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.tablePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromTableName', () => { - const result = client.matchProjectFromTableName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchInstanceFromTableName', () => { - const result = client.matchInstanceFromTableName(fakePath); - assert.strictEqual(result, 'instanceValue'); - assert( - (client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchTableFromTableName', () => { - const result = client.matchTableFromTableName(fakePath); - assert.strictEqual(result, 'tableValue'); - assert( - (client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('snapshot', () => { + const fakePath = "/rendered/path/snapshot"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + snapshot: "snapshotValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.snapshotPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.snapshotPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('snapshotPath', () => { + const result = client.snapshotPath("projectValue", "instanceValue", "clusterValue", "snapshotValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.snapshotPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSnapshotName', () => { + const result = client.matchProjectFromSnapshotName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromSnapshotName', () => { + const result = client.matchInstanceFromSnapshotName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromSnapshotName', () => { + const result = client.matchClusterFromSnapshotName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSnapshotFromSnapshotName', () => { + const result = client.matchSnapshotFromSnapshotName(fakePath); + assert.strictEqual(result, "snapshotValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('table', () => { + const fakePath = "/rendered/path/table"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + table: "tableValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tablePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tablePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tablePath', () => { + const result = client.tablePath("projectValue", "instanceValue", "tableValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tablePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTableName', () => { + const result = client.matchProjectFromTableName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromTableName', () => { + const result = client.matchInstanceFromTableName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTableFromTableName', () => { + const result = client.matchTableFromTableName(fakePath); + assert.strictEqual(result, "tableValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); }); - }); });