diff --git a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/autoscaling_policies.proto b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/autoscaling_policies.proto index 337ec6a64793..123cd73e24e0 100644 --- a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/autoscaling_policies.proto +++ b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/autoscaling_policies.proto @@ -23,7 +23,7 @@ import "google/api/resource.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/empty.proto"; -option go_package = "cloud.google.com/go/dataproc/apiv1/dataprocpb;dataprocpb"; +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; option java_multiple_files = true; option java_outer_classname = "AutoscalingPoliciesProto"; option java_package = "com.google.cloud.dataproc.v1"; diff --git a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/batches.proto b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/batches.proto index cde1351c83d5..56d73f5c8843 100644 --- a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/batches.proto +++ b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/batches.proto @@ -25,7 +25,7 @@ import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "cloud.google.com/go/dataproc/apiv1/dataprocpb;dataprocpb"; +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; option java_multiple_files = true; option java_outer_classname = "BatchesProto"; option java_package = "com.google.cloud.dataproc.v1"; diff --git a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/clusters.proto b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/clusters.proto index d1e46bd3d567..a0a4e33cf2d2 100644 --- a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/clusters.proto +++ b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/clusters.proto @@ -26,7 +26,7 @@ import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "cloud.google.com/go/dataproc/apiv1/dataprocpb;dataprocpb"; +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; option java_multiple_files = true; option java_outer_classname = "ClustersProto"; option java_package = "com.google.cloud.dataproc.v1"; diff --git a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/jobs.proto b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/jobs.proto index 1c19ce66bcd7..8b1dec46020c 100644 --- a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/jobs.proto +++ b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/jobs.proto @@ -24,7 +24,7 @@ import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "cloud.google.com/go/dataproc/apiv1/dataprocpb;dataprocpb"; +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; option java_multiple_files = true; option java_outer_classname = "JobsProto"; option java_package = "com.google.cloud.dataproc.v1"; diff --git a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/node_groups.proto b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/node_groups.proto index 0bd3ef30fd20..5a7e47ef1e81 100644 --- a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/node_groups.proto +++ b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/node_groups.proto @@ -24,7 +24,7 @@ import "google/cloud/dataproc/v1/clusters.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; -option go_package = "cloud.google.com/go/dataproc/apiv1/dataprocpb;dataprocpb"; +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; option java_multiple_files = true; option java_outer_classname = "NodeGroupsProto"; option java_package = "com.google.cloud.dataproc.v1"; diff --git a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/operations.proto b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/operations.proto index 57c913f7a319..d9fad26d2128 100644 --- a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/operations.proto +++ b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/operations.proto @@ -19,7 +19,7 @@ package google.cloud.dataproc.v1; import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "cloud.google.com/go/dataproc/apiv1/dataprocpb;dataprocpb"; +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; option java_multiple_files = true; option java_outer_classname = "OperationsProto"; option java_package = "com.google.cloud.dataproc.v1"; diff --git a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/shared.proto b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/shared.proto index 72192bd40ba6..e3f1091e1802 100644 --- a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/shared.proto +++ b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/shared.proto @@ -21,7 +21,7 @@ import "google/api/resource.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "cloud.google.com/go/dataproc/apiv1/dataprocpb;dataprocpb"; +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; option java_multiple_files = true; option java_outer_classname = "SharedProto"; option java_package = "com.google.cloud.dataproc.v1"; diff --git a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/workflow_templates.proto b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/workflow_templates.proto index 0b81da02e3e1..bb6a639a095e 100644 --- a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/workflow_templates.proto +++ b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/workflow_templates.proto @@ -27,7 +27,7 @@ import "google/protobuf/duration.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "cloud.google.com/go/dataproc/apiv1/dataprocpb;dataprocpb"; +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; option java_multiple_files = true; option java_outer_classname = "WorkflowTemplatesProto"; option java_package = "com.google.cloud.dataproc.v1"; diff --git a/packages/google-cloud-dataproc/protos/protos.json b/packages/google-cloud-dataproc/protos/protos.json index 644b70f6c056..c2852fca4ba8 100644 --- a/packages/google-cloud-dataproc/protos/protos.json +++ b/packages/google-cloud-dataproc/protos/protos.json @@ -8,7 +8,7 @@ "nested": { "v1": { "options": { - "go_package": "cloud.google.com/go/dataproc/apiv1/dataprocpb;dataprocpb", + "go_package": "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb", "java_multiple_files": true, "java_outer_classname": "WorkflowTemplatesProto", "java_package": "com.google.cloud.dataproc.v1", diff --git a/packages/google-cloud-dataproc/samples/generated/v1/snippet_metadata.google.cloud.dataproc.v1.json b/packages/google-cloud-dataproc/samples/generated/v1/snippet_metadata.google.cloud.dataproc.v1.json index 00ac8b239b6b..344268782622 100644 --- a/packages/google-cloud-dataproc/samples/generated/v1/snippet_metadata.google.cloud.dataproc.v1.json +++ b/packages/google-cloud-dataproc/samples/generated/v1/snippet_metadata.google.cloud.dataproc.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-dataproc", - "version": "4.4.0", + "version": "4.4.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-resourcemanager/README.md b/packages/google-cloud-resourcemanager/README.md index ab42819b66ef..2f1d2913be46 100644 --- a/packages/google-cloud-resourcemanager/README.md +++ b/packages/google-cloud-resourcemanager/README.md @@ -112,10 +112,15 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Projects.update_project | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/projects.update_project.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/projects.update_project.js,samples/README.md) | | Tag_bindings.create_tag_binding | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.create_tag_binding.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.create_tag_binding.js,samples/README.md) | | Tag_bindings.delete_tag_binding | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.delete_tag_binding.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.delete_tag_binding.js,samples/README.md) | +| Tag_bindings.list_effective_tags | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_effective_tags.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_effective_tags.js,samples/README.md) | | Tag_bindings.list_tag_bindings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_tag_bindings.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_tag_bindings.js,samples/README.md) | +| Tag_holds.create_tag_hold | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.create_tag_hold.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.create_tag_hold.js,samples/README.md) | +| Tag_holds.delete_tag_hold | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.delete_tag_hold.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.delete_tag_hold.js,samples/README.md) | +| Tag_holds.list_tag_holds | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.list_tag_holds.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.list_tag_holds.js,samples/README.md) | | Tag_keys.create_tag_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.create_tag_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.create_tag_key.js,samples/README.md) | | Tag_keys.delete_tag_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.delete_tag_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.delete_tag_key.js,samples/README.md) | | Tag_keys.get_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_iam_policy.js,samples/README.md) | +| Tag_keys.get_namespaced_tag_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_namespaced_tag_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_namespaced_tag_key.js,samples/README.md) | | Tag_keys.get_tag_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_tag_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_tag_key.js,samples/README.md) | | Tag_keys.list_tag_keys | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.list_tag_keys.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.list_tag_keys.js,samples/README.md) | | Tag_keys.set_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.set_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.set_iam_policy.js,samples/README.md) | @@ -124,6 +129,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Tag_values.create_tag_value | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.create_tag_value.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.create_tag_value.js,samples/README.md) | | Tag_values.delete_tag_value | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.delete_tag_value.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.delete_tag_value.js,samples/README.md) | | Tag_values.get_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_iam_policy.js,samples/README.md) | +| Tag_values.get_namespaced_tag_value | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_namespaced_tag_value.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_namespaced_tag_value.js,samples/README.md) | | Tag_values.get_tag_value | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_tag_value.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_tag_value.js,samples/README.md) | | Tag_values.list_tag_values | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.list_tag_values.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.list_tag_values.js,samples/README.md) | | Tag_values.set_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.set_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.set_iam_policy.js,samples/README.md) | diff --git a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/folders.proto b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/folders.proto index 98568a26e65f..036bf4e6daf5 100644 --- a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/folders.proto +++ b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/folders.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -124,7 +124,9 @@ service Folders { // Updates a folder, changing its `display_name`. // Changes to the folder `display_name` will be rejected if they violate // either the `display_name` formatting rules or the naming constraints - // described in the [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder] documentation. + // described in the + // [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder] + // documentation. // // The folder's `display_name` must start and end with a letter or digit, // may contain letters, digits, spaces, hyphens and underscores and can be @@ -162,9 +164,9 @@ service Folders { // `FolderOperation` message as an aid to stateless clients. // Folder moves will be rejected if they violate either the naming, height, // or fanout constraints described in the - // [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder] documentation. - // The caller must have `resourcemanager.folders.move` permission on the - // folder's current and proposed new parent. + // [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder] + // documentation. The caller must have `resourcemanager.folders.move` + // permission on the folder's current and proposed new parent. rpc MoveFolder(MoveFolderRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v3/{name=folders/*}:move" @@ -178,11 +180,13 @@ service Folders { } // Requests deletion of a folder. The folder is moved into the - // [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state - // immediately, and is deleted approximately 30 days later. This method may - // only be called on an empty folder, where a folder is empty if it doesn't - // contain any folders or projects in the [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. - // If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] + // [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] + // state immediately, and is deleted approximately 30 days later. This method + // may only be called on an empty folder, where a folder is empty if it + // doesn't contain any folders or projects in the + // [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If + // called on a folder in + // [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] // state the operation will result in a no-op success. // The caller must have `resourcemanager.folders.delete` permission on the // identified folder. @@ -198,15 +202,18 @@ service Folders { } // Cancels the deletion request for a folder. This method may be called on a - // folder in any state. If the folder is in the [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] - // state the result will be a no-op success. In order to succeed, the folder's - // parent must be in the [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. In addition, - // reintroducing the folder into the tree must not violate folder naming, - // height, and fanout constraints described in the - // [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder] documentation. - // The caller must have `resourcemanager.folders.undelete` permission on the - // identified folder. - rpc UndeleteFolder(UndeleteFolderRequest) returns (google.longrunning.Operation) { + // folder in any state. If the folder is in the + // [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state the + // result will be a no-op success. In order to succeed, the folder's parent + // must be in the + // [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. In + // addition, reintroducing the folder into the tree must not violate folder + // naming, height, and fanout constraints described in the + // [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder] + // documentation. The caller must have `resourcemanager.folders.undelete` + // permission on the identified folder. + rpc UndeleteFolder(UndeleteFolderRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v3/{name=folders/*}:undelete" body: "*" @@ -223,7 +230,8 @@ service Folders { // be the folder's resource name, for example: "folders/1234". // The caller must have `resourcemanager.folders.getIamPolicy` permission // on the identified folder. - 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: "/v3/{resource=folders/*}:getIamPolicy" body: "*" @@ -236,7 +244,8 @@ service Folders { // "folders/1234". // The caller must have `resourcemanager.folders.setIamPolicy` permission // on the identified folder. - 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: "/v3/{resource=folders/*}:setIamPolicy" body: "*" @@ -249,7 +258,8 @@ service Folders { // for example: "folders/1234". // // There are no permissions required for making this API call. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { option (google.api.http) = { post: "/v3/{resource=folders/*}:testIamPermissions" body: "*" @@ -304,17 +314,20 @@ message Folder { State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Timestamp when the folder was created. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Timestamp when the folder was last modified. - google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Timestamp when the folder was requested to be deleted. - google.protobuf.Timestamp delete_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp delete_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. A checksum computed by the server based on the current value of the folder - // resource. This may be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. + // Output only. A checksum computed by the server based on the current value + // of the folder resource. This may be sent on update and delete requests to + // ensure the client has an up-to-date value before proceeding. string etag = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; } @@ -332,20 +345,23 @@ message GetFolderRequest { // The ListFolders request message. message ListFoldersRequest { - // Required. The resource name of the organization or folder whose folders are - // being listed. - // Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. + // Required. The name of the parent resource whose folders are being listed. + // Only children of this parent resource are listed; descendants are not + // listed. + // + // If the parent is a folder, use the value `folders/{folder_id}`. If the + // parent is an organization, use the value `organizations/{org_id}`. + // // Access to this method is controlled by checking the // `resourcemanager.folders.list` permission on the `parent`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "*" - } + (google.api.resource_reference) = { child_type: "*" } ]; - // Optional. The maximum number of folders to return in the response. - // If unspecified, server picks an appropriate default. + // Optional. The maximum number of folders to return in the response. The + // server can return fewer folders than requested. If unspecified, server + // picks an appropriate default. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; // Optional. A pagination token returned from a previous call to `ListFolders` @@ -371,12 +387,13 @@ message ListFoldersResponse { // The request message for searching folders. message SearchFoldersRequest { - // Optional. The maximum number of folders to return in the response. - // If unspecified, server picks an appropriate default. + // Optional. The maximum number of folders to return in the response. The + // server can return fewer folders than requested. If unspecified, server + // picks an appropriate default. int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - // Optional. A pagination token returned from a previous call to `SearchFolders` - // that indicates from where search should continue. + // Optional. A pagination token returned from a previous call to + // `SearchFolders` that indicates from where search should continue. string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; // Optional. Search criteria used to select the folders to return. @@ -426,8 +443,8 @@ message SearchFoldersResponse { // The CreateFolder request message. message CreateFolderRequest { - // Required. The folder being created, only the display name and parent will be - // consulted. All other fields will be ignored. + // Required. The folder being created, only the display name and parent will + // be consulted. All other fields will be ignored. Folder folder = 2 [(google.api.field_behavior) = REQUIRED]; } @@ -450,20 +467,19 @@ message CreateFolderMetadata { // [MoveFolder][google.cloud.resourcemanager.v3.Folders.MoveFolder] method to // change the `parent` field. message UpdateFolderRequest { - // Required. The new definition of the Folder. It must include the `name` field, which - // cannot be changed. + // Required. The new definition of the Folder. It must include the `name` + // field, which cannot be changed. Folder folder = 1 [(google.api.field_behavior) = REQUIRED]; // Required. Fields to be updated. // Only the `display_name` can be updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; } // A status object which is used as the `metadata` field for the Operation // returned by UpdateFolder. -message UpdateFolderMetadata { - -} +message UpdateFolderMetadata {} // The MoveFolder request message. message MoveFolderRequest { @@ -476,14 +492,12 @@ message MoveFolderRequest { } ]; - // Required. The resource name of the folder or organization which should be the - // folder's new parent. - // Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. + // Required. The resource name of the folder or organization which should be + // the folder's new parent. Must be of the form `folders/{folder_id}` or + // `organizations/{org_id}`. string destination_parent = 2 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "*" - } + (google.api.resource_reference) = { child_type: "*" } ]; } @@ -513,9 +527,7 @@ message DeleteFolderRequest { // A status object which is used as the `metadata` field for the `Operation` // returned by `DeleteFolder`. -message DeleteFolderMetadata { - -} +message DeleteFolderMetadata {} // The UndeleteFolder request message. message UndeleteFolderRequest { @@ -531,6 +543,4 @@ message UndeleteFolderRequest { // A status object which is used as the `metadata` field for the `Operation` // returned by `UndeleteFolder`. -message UndeleteFolderMetadata { - -} +message UndeleteFolderMetadata {} diff --git a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/organizations.proto b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/organizations.proto index 8f8a6f34a53f..7b0ed95a501f 100644 --- a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/organizations.proto +++ b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/organizations.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -54,7 +54,8 @@ service Organizations { // // Search will only return organizations on which the user has the permission // `resourcemanager.organizations.get` - rpc SearchOrganizations(SearchOrganizationsRequest) returns (SearchOrganizationsResponse) { + rpc SearchOrganizations(SearchOrganizationsRequest) + returns (SearchOrganizationsResponse) { option (google.api.http) = { get: "/v3/organizations:search" }; @@ -67,7 +68,8 @@ service Organizations { // // Authorization requires the IAM permission // `resourcemanager.organizations.getIamPolicy` on the specified organization. - 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: "/v3/{resource=organizations/*}:getIamPolicy" body: "*" @@ -81,7 +83,8 @@ service Organizations { // // Authorization requires the IAM permission // `resourcemanager.organizations.setIamPolicy` on the specified organization. - 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: "/v3/{resource=organizations/*}:setIamPolicy" body: "*" @@ -94,7 +97,8 @@ service Organizations { // for example: "organizations/123". // // There are no permissions required for making this API call. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { option (google.api.http) = { post: "/v3/{resource=organizations/*}:testIamPermissions" body: "*" @@ -150,26 +154,29 @@ message Organization { State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Timestamp when the Organization was created. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Timestamp when the Organization was last modified. - google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Timestamp when the Organization was requested for deletion. - google.protobuf.Timestamp delete_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp delete_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. A checksum computed by the server based on the current value of the - // Organization resource. This may be sent on update and delete requests to - // ensure the client has an up-to-date value before proceeding. + // Output only. A checksum computed by the server based on the current value + // of the Organization resource. This may be sent on update and delete + // requests to ensure the client has an up-to-date value before proceeding. string etag = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; } // The request sent to the `GetOrganization` method. The `name` field is // required. `organization_id` is no longer accepted. message GetOrganizationRequest { - // Required. The resource name of the Organization to fetch. This is the organization's - // relative path in the API, formatted as "organizations/[organizationId]". - // For example, "organizations/1234". + // Required. The resource name of the Organization to fetch. This is the + // organization's relative path in the API, formatted as + // "organizations/[organizationId]". For example, "organizations/1234". string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -181,15 +188,17 @@ message GetOrganizationRequest { // The request sent to the `SearchOrganizations` method. message SearchOrganizationsRequest { // Optional. The maximum number of organizations to return in the response. - // If unspecified, server picks an appropriate default. + // The server can return fewer organizations than requested. If unspecified, + // server picks an appropriate default. int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - // Optional. A pagination token returned from a previous call to `SearchOrganizations` - // that indicates from where listing should continue. + // Optional. A pagination token returned from a previous call to + // `SearchOrganizations` that indicates from where listing should continue. string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. An optional query string used to filter the Organizations to return in - // the response. Query rules are case-insensitive. + // Optional. An optional query string used to filter the Organizations to + // return in the response. Query rules are case-insensitive. + // // // ``` // | Field | Description | @@ -225,12 +234,8 @@ message SearchOrganizationsResponse { // A status object which is used as the `metadata` field for the operation // returned by DeleteOrganization. -message DeleteOrganizationMetadata { - -} +message DeleteOrganizationMetadata {} // A status object which is used as the `metadata` field for the Operation // returned by UndeleteOrganization. -message UndeleteOrganizationMetadata { - -} +message UndeleteOrganizationMetadata {} diff --git a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/projects.proto b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/projects.proto index 693e4609e96a..840d538c261a 100644 --- a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/projects.proto +++ b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/projects.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -88,7 +88,8 @@ service Projects { // seconds, but can sometimes take much longer. The tracking `Operation` is // automatically deleted after a few hours, so there is no need to call // `DeleteOperation`. - rpc CreateProject(CreateProjectRequest) returns (google.longrunning.Operation) { + rpc CreateProject(CreateProjectRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v3/projects" body: "project" @@ -106,7 +107,8 @@ service Projects { // // The caller must have `resourcemanager.projects.update` permission for this // project. - rpc UpdateProject(UpdateProjectRequest) returns (google.longrunning.Operation) { + rpc UpdateProject(UpdateProjectRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { patch: "/v3/{project.name=projects/*}" body: "project" @@ -126,9 +128,12 @@ service Projects { // Upon success, the `Operation.response` field will be populated with the // moved project. // - // The caller must have `resourcemanager.projects.update` permission on the - // project and have `resourcemanager.projects.move` permission on the - // project's current and proposed new parent. + // The caller must have `resourcemanager.projects.move` permission on the + // project, on the project's current and proposed new parent. + // + // If project has no current parent, or it currently does not have an + // associated organization resource, you will also need the + // `resourcemanager.projects.setIamPolicy` permission in the project. // // rpc MoveProject(MoveProjectRequest) returns (google.longrunning.Operation) { @@ -151,7 +156,8 @@ service Projects { // // This method changes the Project's lifecycle state from // [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE] - // to [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED]. + // to + // [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED]. // The deletion starts at an unspecified time, // at which point the Project is no longer accessible. // @@ -175,7 +181,8 @@ service Projects { // // The caller must have `resourcemanager.projects.delete` permissions for this // project. - rpc DeleteProject(DeleteProjectRequest) returns (google.longrunning.Operation) { + rpc DeleteProject(DeleteProjectRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v3/{name=projects/*}" }; @@ -195,7 +202,8 @@ service Projects { // // The caller must have `resourcemanager.projects.undelete` permission for // this project. - rpc UndeleteProject(UndeleteProjectRequest) returns (google.longrunning.Operation) { + rpc UndeleteProject(UndeleteProjectRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v3/{name=projects/*}:undelete" body: "*" @@ -207,9 +215,11 @@ service Projects { }; } - // Returns the IAM access control policy for the specified project. + // Returns the IAM access control policy for the specified project, in the + // format `projects/{ProjectIdOrNumber}` e.g. projects/123. // Permission is denied if the policy or the resource do not exist. - 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: "/v3/{resource=projects/*}:getIamPolicy" body: "*" @@ -217,7 +227,8 @@ service Projects { option (google.api.method_signature) = "resource"; } - // Sets the IAM access control policy for the specified project. + // Sets the IAM access control policy for the specified project, in the + // format `projects/{ProjectIdOrNumber}` e.g. projects/123. // // CAUTION: This method will replace the existing policy, and cannot be used // to append additional IAM settings. @@ -249,19 +260,16 @@ service Projects { // `setIamPolicy()`; // they must be sent only using the Cloud Platform Console. // - // + Membership changes that leave the project without any owners that have - // accepted the Terms of Service (ToS) will be rejected. - // // + If the project is not part of an organization, there must be at least // one owner who has accepted the Terms of Service (ToS) agreement in the // policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner // from the policy will fail. This restriction also applies to legacy // projects that no longer have owners who have accepted the ToS. Edits to // IAM policies will be rejected until the lack of a ToS-accepting owner is - // rectified. - // - // + Calling this method requires enabling the App Engine Admin API. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + // rectified. If the project is part of an organization, you can remove all + // owners, potentially making the organization inaccessible. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { option (google.api.http) = { post: "/v3/{resource=projects/*}:setIamPolicy" body: "*" @@ -269,8 +277,10 @@ service Projects { option (google.api.method_signature) = "resource, policy"; } - // Returns permissions that a caller has on the specified project. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + // Returns permissions that a caller has on the specified project, in the + // format `projects/{ProjectIdOrNumber}` e.g. projects/123.. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { option (google.api.http) = { post: "/v3/{resource=projects/*}:testIamPermissions" body: "*" @@ -307,8 +317,8 @@ message Project { DELETE_REQUESTED = 2; } - // Output only. The unique resource name of the project. It is an int64 generated number - // prefixed by "projects/". + // Output only. The unique resource name of the project. It is an int64 + // generated number prefixed by "projects/". // // Example: `projects/415104041262` string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; @@ -337,17 +347,20 @@ message Project { string display_name = 5 [(google.api.field_behavior) = OPTIONAL]; // Output only. Creation time. - google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The most recent time this resource was modified. - google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The time at which this resource was requested for deletion. - google.protobuf.Timestamp delete_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. A checksum computed by the server based on the current value of the Project - // resource. This may be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. + // Output only. A checksum computed by the server based on the current value + // of the Project resource. This may be sent on update and delete requests to + // ensure the client has an up-to-date value before proceeding. string etag = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; // Optional. The labels associated with this project. @@ -358,7 +371,7 @@ message Project { // Label values must be between 0 and 63 characters long and must conform // to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. // - // No more than 256 labels can be associated with a given resource. + // No more than 64 labels can be associated with a given resource. // // Clients should store labels in a representation such as JSON that does not // depend on specific characters being disallowed. @@ -384,20 +397,20 @@ message GetProjectRequest { // [ListProjects][google.cloud.resourcemanager.v3.Projects.ListProjects] // method. message ListProjectsRequest { - // Required. The name of the parent resource to list projects under. + // Required. The name of the parent resource whose projects are being listed. + // Only children of this parent resource are listed; descendants are not + // listed. // - // For example, setting this field to 'folders/1234' would list all projects - // directly under that folder. + // If the parent is a folder, use the value `folders/{folder_id}`. If the + // parent is an organization, use the value `organizations/{org_id}`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "*" - } + (google.api.resource_reference) = { child_type: "*" } ]; - // Optional. A pagination token returned from a previous call to [ListProjects] - // [google.cloud.resourcemanager.v3.Projects.ListProjects] - // that indicates from where listing should continue. + // Optional. A pagination token returned from a previous call to + // [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that + // indicates from where listing should continue. string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; // Optional. The maximum number of projects to return in the response. @@ -405,8 +418,8 @@ message ListProjectsRequest { // If unspecified, server picks an appropriate default. int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Indicate that projects in the `DELETE_REQUESTED` state should also be - // returned. Normally only `ACTIVE` projects are returned. + // Optional. Indicate that projects in the `DELETE_REQUESTED` state should + // also be returned. Normally only `ACTIVE` projects are returned. bool show_deleted = 4 [(google.api.field_behavior) = OPTIONAL]; } @@ -444,22 +457,22 @@ message ListProjectsResponse { message SearchProjectsRequest { // Optional. A query string for searching for projects that the caller has // `resourcemanager.projects.get` permission to. If multiple fields are - // included in the query, the it will return results that match any of the + // included in the query, then it will return results that match any of the // fields. Some eligible fields are: // // ``` // | Field | Description | // |-------------------------|----------------------------------------------| // | displayName, name | Filters by displayName. | - // | parent | Project's parent. (for example: folders/123, - // organizations/*) Prefer parent field over parent.type and parent.id. | - // | parent.type | Parent's type: `folder` or `organization`. | - // | parent.id | Parent's id number (for example: 123) | - // | id, projectId | Filters by projectId. | - // | state, lifecycleState | Filters by state. | - // | labels | Filters by label name or value. | - // | labels. (where *key* is the name of a label) | Filters by label - // name. | + // | parent | Project's parent (for example: folders/123, + // organizations/*). Prefer parent field over parent.type and parent.id.| | + // parent.type | Parent's type: `folder` or `organization`. | | + // parent.id | Parent's id number (for example: 123) | | + // id, projectId | Filters by projectId. | | + // state, lifecycleState | Filters by state. | | + // labels | Filters by label name or value. | | + // labels.\ (where *key* is the name of a label) | Filters by label + // name.| // ``` // // Search expressions are case insensitive. @@ -475,17 +488,17 @@ message SearchProjectsRequest { // | NAME:howl | Equivalent to above. | // | labels.color:* | The project has the label `color`. | // | labels.color:red | The project's label `color` has the value `red`. | - // | labels.color:red labels.size:big | The project's label `color` has - // the value `red` and its label `size` has the value `big`. | + // | labels.color:red labels.size:big | The project's label `color` has the + // value `red` or its label `size` has the value `big`. | // ``` // // If no query is specified, the call will return projects for which the user // has the `resourcemanager.projects.get` permission. string query = 1 [(google.api.field_behavior) = OPTIONAL]; - // Optional. A pagination token returned from a previous call to [ListProjects] - // [google.cloud.resourcemanager.v3.Projects.ListProjects] - // that indicates from where listing should continue. + // Optional. A pagination token returned from a previous call to + // [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that + // indicates from where listing should continue. string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; // Optional. The maximum number of projects to return in the response. @@ -531,7 +544,7 @@ message CreateProjectRequest { // // If the `parent` field is set, the `resourcemanager.projects.create` // permission is checked on the parent resource. If no parent is set and - // the authorization credentials belong to an Organziation, the parent + // the authorization credentials belong to an Organization, the parent // will be set to that Organization. Project project = 1 [(google.api.field_behavior) = REQUIRED]; } @@ -564,14 +577,13 @@ message UpdateProjectRequest { Project project = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. An update mask to selectively update fields. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = OPTIONAL]; } // A status object which is used as the `metadata` field for the Operation // returned by UpdateProject. -message UpdateProjectMetadata { - -} +message UpdateProjectMetadata {} // The request sent to // [MoveProject][google.cloud.resourcemanager.v3.Projects.MoveProject] @@ -588,17 +600,13 @@ message MoveProjectRequest { // Required. The new parent to move the Project under. string destination_parent = 2 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "*" - } + (google.api.resource_reference) = { child_type: "*" } ]; } // A status object which is used as the `metadata` field for the Operation // returned by MoveProject. -message MoveProjectMetadata { - -} +message MoveProjectMetadata {} // [DeleteProject][google.cloud.resourcemanager.v3.Projects.DeleteProject] // method. @@ -614,9 +622,7 @@ message DeleteProjectRequest { // A status object which is used as the `metadata` field for the Operation // returned by `DeleteProject`. -message DeleteProjectMetadata { - -} +message DeleteProjectMetadata {} // The request sent to the [UndeleteProject] // [google.cloud.resourcemanager.v3.Projects.UndeleteProject] @@ -635,6 +641,4 @@ message UndeleteProjectRequest { // A status object which is used as the `metadata` field for the Operation // returned by `UndeleteProject`. -message UndeleteProjectMetadata { - -} +message UndeleteProjectMetadata {} diff --git a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_bindings.proto b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_bindings.proto index a9dbac3b06f2..462757071583 100644 --- a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_bindings.proto +++ b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_bindings.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; option csharp_namespace = "Google.Cloud.ResourceManager.V3"; option go_package = "cloud.google.com/go/resourcemanager/apiv3/resourcemanagerpb;resourcemanagerpb"; @@ -31,28 +32,29 @@ option php_namespace = "Google\\Cloud\\ResourceManager\\V3"; option ruby_package = "Google::Cloud::ResourceManager::V3"; // Allow users to create and manage TagBindings between TagValues and -// different cloud resources throughout the GCP resource hierarchy. +// different Google Cloud resources throughout the GCP resource hierarchy. service TagBindings { option (google.api.default_host) = "cloudresourcemanager.googleapis.com"; option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform," "https://www.googleapis.com/auth/cloud-platform.read-only"; - // Lists the TagBindings for the given cloud resource, as specified with - // `parent`. + // Lists the TagBindings for the given Google Cloud resource, as specified + // with `parent`. // // NOTE: The `parent` field is expected to be a full resource name: // https://cloud.google.com/apis/design/resource_names#full_resource_name - rpc ListTagBindings(ListTagBindingsRequest) returns (ListTagBindingsResponse) { + rpc ListTagBindings(ListTagBindingsRequest) + returns (ListTagBindingsResponse) { option (google.api.http) = { get: "/v3/tagBindings" }; option (google.api.method_signature) = "parent"; } - // Creates a TagBinding between a TagValue and a cloud resource - // (currently project, folder, or organization). - rpc CreateTagBinding(CreateTagBindingRequest) returns (google.longrunning.Operation) { + // Creates a TagBinding between a TagValue and a Google Cloud resource. + rpc CreateTagBinding(CreateTagBindingRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v3/tagBindings" body: "tag_binding" @@ -65,7 +67,8 @@ service TagBindings { } // Deletes a TagBinding. - rpc DeleteTagBinding(DeleteTagBindingRequest) returns (google.longrunning.Operation) { + rpc DeleteTagBinding(DeleteTagBindingRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v3/{name=tagBindings/**}" }; @@ -75,12 +78,21 @@ service TagBindings { metadata_type: "DeleteTagBindingMetadata" }; } + + // Return a list of effective tags for the given Google Cloud resource, as + // specified in `parent`. + rpc ListEffectiveTags(ListEffectiveTagsRequest) + returns (ListEffectiveTagsResponse) { + option (google.api.http) = { + get: "/v3/effectiveTags" + }; + option (google.api.method_signature) = "parent"; + } } // A TagBinding represents a connection between a TagValue and a cloud -// resource (currently project, folder, or organization). Once a TagBinding is -// created, the TagValue is applied to all the descendants of the cloud -// resource. +// resource Once a TagBinding is created, the TagValue is applied to all the +// descendants of the Google Cloud resource. message TagBinding { option (google.api.resource) = { type: "cloudresourcemanager.googleapis.com/TagBinding" @@ -99,27 +111,32 @@ message TagBinding { // The TagValue of the TagBinding. // Must be of the form `tagValues/456`. string tag_value = 3; + + // The namespaced name for the TagValue of the TagBinding. + // Must be in the format + // `{parent_id}/{tag_key_short_name}/{short_name}`. + // + // For methods that support TagValue namespaced name, only one of + // tag_value_namespaced_name or tag_value may be filled. Requests with both + // fields will be rejected. + string tag_value_namespaced_name = 4; } // Runtime operation information for creating a TagValue. -message CreateTagBindingMetadata { - -} +message CreateTagBindingMetadata {} // The request message to create a TagBinding. message CreateTagBindingRequest { // Required. The TagBinding to be created. TagBinding tag_binding = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. Set to true to perform the validations necessary for creating the resource, - // but not actually perform the action. + // Optional. Set to true to perform the validations necessary for creating the + // resource, but not actually perform the action. bool validate_only = 2 [(google.api.field_behavior) = OPTIONAL]; } // Runtime operation information for deleting a TagBinding. -message DeleteTagBindingMetadata { - -} +message DeleteTagBindingMetadata {} // The request message to delete a TagBinding. message DeleteTagBindingRequest { @@ -136,30 +153,27 @@ message DeleteTagBindingRequest { // The request message to list all TagBindings for a parent. message ListTagBindingsRequest { - // Required. The full resource name of a resource for which you want to list existing - // TagBindings. - // E.g. "//cloudresourcemanager.googleapis.com/projects/123" + // Required. The full resource name of a resource for which you want to list + // existing TagBindings. E.g. + // "//cloudresourcemanager.googleapis.com/projects/123" string parent = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "*" - } + (google.api.resource_reference) = { child_type: "*" } ]; - // Optional. The maximum number of TagBindings to return in the response. The server - // allows a maximum of 300 TagBindings to return. If unspecified, the server - // will use 100 as the default. + // Optional. The maximum number of TagBindings to return in the response. The + // server allows a maximum of 300 TagBindings to return. If unspecified, the + // server will use 100 as the default. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. A pagination token returned from a previous call to `ListTagBindings` - // that indicates where this listing should continue from. + // Optional. A pagination token returned from a previous call to + // `ListTagBindings` that indicates where this listing should continue from. string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; } // The ListTagBindings response. message ListTagBindingsResponse { - // A possibly paginated list of TagBindings for the specified TagValue or - // resource. + // A possibly paginated list of TagBindings for the specified resource. repeated TagBinding tag_bindings = 1; // Pagination token. @@ -175,3 +189,77 @@ message ListTagBindingsResponse { // Pagination tokens have a limited lifetime. string next_page_token = 2; } + +// The request message to ListEffectiveTags +message ListEffectiveTagsRequest { + // Required. The full resource name of a resource for which you want to list + // the effective tags. E.g. + // "//cloudresourcemanager.googleapis.com/projects/123" + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The maximum number of effective tags to return in the response. + // The server allows a maximum of 300 effective tags to return in a single + // page. If unspecified, the server will use 100 as the default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A pagination token returned from a previous call to + // `ListEffectiveTags` that indicates from where this listing should continue. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response of ListEffectiveTags. +message ListEffectiveTagsResponse { + // A possibly paginated list of effective tags for the specified resource. + repeated EffectiveTag effective_tags = 1; + + // Pagination token. + // + // If the result set is too large to fit in a single response, this token + // is returned. It encodes the position of the current result cursor. + // Feeding this value into a new list request with the `page_token` parameter + // gives the next page of the results. + // + // When `next_page_token` is not filled in, there is no next page and + // the list returned is the last page in the result set. + // + // Pagination tokens have a limited lifetime. + string next_page_token = 2; +} + +// An EffectiveTag represents a tag that applies to a resource during policy +// evaluation. Tags can be either directly bound to a resource or inherited from +// its ancestor. EffectiveTag contains the name and +// namespaced_name of the tag value and tag key, with additional fields of +// `inherited` to indicate the inheritance status of the effective tag. +message EffectiveTag { + // Resource name for TagValue in the format `tagValues/456`. + string tag_value = 1 [(google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/TagValue" + }]; + + // Namespaced name of the TagValue. Now only supported in the format + // `{organization_id}/{tag_key_short_name}/{tag_value_short_name}`. + // Other formats will be supported when we add non-org parented tags. + string namespaced_tag_value = 2; + + // The name of the TagKey, in the format `tagKeys/{id}`, such as + // `tagKeys/123`. + string tag_key = 3 [(google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/TagKey" + }]; + + // The namespaced_name of the TagKey. Now only supported in the format of + // `{organization_id}/{tag_key_short_name}`. Other formats will be + // supported when we add non-org parented tags. + string namespaced_tag_key = 4; + + // The parent name of the tag key. + // Must be in the format `organizations/{organization_id}`. + string tag_key_parent_name = 6; + + // Indicates the inheritance status of a tag value + // attached to the given resource. If the tag value is inherited from one of + // the resource's ancestors, inherited will be true. If false, then the tag + // value is directly attached to the resource, inherited will be false. + bool inherited = 5; +} diff --git a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_holds.proto b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_holds.proto new file mode 100644 index 000000000000..15c446913f26 --- /dev/null +++ b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_holds.proto @@ -0,0 +1,216 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.resourcemanager.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ResourceManager.V3"; +option go_package = "cloud.google.com/go/resourcemanager/apiv3/resourcemanagerpb;resourcemanagerpb"; +option java_multiple_files = true; +option java_outer_classname = "TagHoldsProto"; +option java_package = "com.google.cloud.resourcemanager.v3"; +option php_namespace = "Google\\Cloud\\ResourceManager\\V3"; +option ruby_package = "Google::Cloud::ResourceManager::V3"; + +// Allow users to create and manage TagHolds for TagValues. TagHolds represent +// the use of a Tag Value that is not captured by TagBindings but +// should still block TagValue deletion (such as a reference in a policy +// condition). This service provides isolated failure domains by cloud location +// so that TagHolds can be managed in the same location as their usage. +service TagHolds { + option (google.api.default_host) = "cloudresourcemanager.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only"; + + // Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same + // resource and origin exists under the same TagValue. + rpc CreateTagHold(CreateTagHoldRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3/{parent=tagValues/*}/tagHolds" + body: "tag_hold" + }; + option (google.api.method_signature) = "parent,tag_hold"; + option (google.longrunning.operation_info) = { + response_type: "TagHold" + metadata_type: "CreateTagHoldMetadata" + }; + } + + // Deletes a TagHold. + rpc DeleteTagHold(DeleteTagHoldRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v3/{name=tagValues/*/tagHolds/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteTagHoldMetadata" + }; + } + + // Lists TagHolds under a TagValue. + rpc ListTagHolds(ListTagHoldsRequest) returns (ListTagHoldsResponse) { + option (google.api.http) = { + get: "/v3/{parent=tagValues/*}/tagHolds" + }; + option (google.api.method_signature) = "parent"; + } +} + +// A TagHold represents the use of a TagValue that is not captured by +// TagBindings. If a TagValue has any TagHolds, deletion will be blocked. +// This resource is intended to be created in the same cloud location as the +// `holder`. +message TagHold { + option (google.api.resource) = { + type: "cloudresourcemanager.googleapis.com/TagHold" + pattern: "tagValues/{tag_value}/tagHolds/{tag_hold}" + }; + + // Output only. The resource name of a TagHold. This is a String of the form: + // `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}` + // (e.g. `tagValues/123/tagHolds/456`). This resource name is generated by + // the server. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The name of the resource where the TagValue is being used. Must + // be less than 200 characters. E.g. + // `//compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group` + string holder = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional string representing the origin of this request. This + // field should include human-understandable information to distinguish + // origins from each other. Must be less than 200 characters. E.g. + // `migs-35678234` + string origin = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A URL where an end user can learn more about removing this hold. + // E.g. + // `https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing` + string help_link = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time this TagHold was created. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message to create a TagHold. +message CreateTagHoldRequest { + // Required. The resource name of the TagHold's parent TagValue. Must be of + // the form: `tagValues/{tag-value-id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudresourcemanager.googleapis.com/TagHold" + } + ]; + + // Required. The TagHold to be created. + TagHold tag_hold = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Set to true to perform the validations necessary for creating the + // resource, but not actually perform the action. + bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Runtime operation information for creating a TagHold. +// (-- The metadata is currently empty, but may include information in the +// future. --) +message CreateTagHoldMetadata {} + +// The request message to delete a TagHold. +message DeleteTagHoldRequest { + // Required. The resource name of the TagHold to delete. Must be of the form: + // `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/TagHold" + } + ]; + + // Optional. Set to true to perform the validations necessary for deleting the + // resource, but not actually perform the action. + bool validate_only = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Runtime operation information for deleting a TagHold. +// (-- The metadata is currently empty, but may include information in the +// future. --) +message DeleteTagHoldMetadata {} + +// The request message for listing the TagHolds under a TagValue. +message ListTagHoldsRequest { + // Required. The resource name of the parent TagValue. Must be of the form: + // `tagValues/{tag-value-id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudresourcemanager.googleapis.com/TagHold" + } + ]; + + // Optional. The maximum number of TagHolds to return in the response. The + // server allows a maximum of 300 TagHolds to return. If unspecified, the + // server will use 100 as the default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A pagination token returned from a previous call to + // `ListTagHolds` that indicates where this listing should continue from. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Criteria used to select a subset of TagHolds parented by the + // TagValue to return. This field follows the syntax defined by aip.dev/160; + // the `holder` and `origin` fields are supported for filtering. Currently + // only `AND` syntax is supported. Some example queries are: + // + // * `holder = + // //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group` + // * `origin = 35678234` + // * `holder = + // //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group + // AND origin = 35678234` + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The ListTagHolds response. +message ListTagHoldsResponse { + // A possibly paginated list of TagHolds. + repeated TagHold tag_holds = 1; + + // Pagination token. + // + // If the result set is too large to fit in a single response, this token + // is returned. It encodes the position of the current result cursor. + // Feeding this value into a new list request with the `page_token` parameter + // gives the next page of the results. + // + // When `next_page_token` is not filled in, there is no next page and + // the list returned is the last page in the result set. + // + // Pagination tokens have a limited lifetime. + string next_page_token = 2; +} diff --git a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_keys.proto b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_keys.proto index 3d0500141b13..46c575477769 100644 --- a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_keys.proto +++ b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_keys.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -58,10 +58,20 @@ service TagKeys { option (google.api.method_signature) = "name"; } + // Retrieves a TagKey by its namespaced name. + // This method will return `PERMISSION_DENIED` if the key does not exist + // or the user does not have permission to view it. + rpc GetNamespacedTagKey(GetNamespacedTagKeyRequest) returns (TagKey) { + option (google.api.http) = { + get: "/v3/tagKeys/namespaced" + }; + option (google.api.method_signature) = "name"; + } + // Creates a new TagKey. If another request with the same parameters is // sent while the original request is in process, the second request - // will receive an error. A maximum of 300 TagKeys can exist under a parent at - // any given time. + // will receive an error. A maximum of 1000 TagKeys can exist under a parent + // at any given time. rpc CreateTagKey(CreateTagKeyRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v3/tagKeys" @@ -106,7 +116,8 @@ service TagKeys { // The caller must have // `cloudresourcemanager.googleapis.com/tagKeys.getIamPolicy` permission on // the specified TagKey. - 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: "/v3/{resource=tagKeys/*}:getIamPolicy" body: "*" @@ -119,7 +130,8 @@ service TagKeys { // For example, "tagKeys/1234". // The caller must have `resourcemanager.tagKeys.setIamPolicy` permission // on the identified tagValue. - 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: "/v3/{resource=tagKeys/*}:setIamPolicy" body: "*" @@ -132,7 +144,8 @@ service TagKeys { // For example, "tagKeys/1234". // // There are no permissions required for making this API call. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { option (google.api.http) = { post: "/v3/{resource=tagKeys/*}:testIamPermissions" body: "*" @@ -158,8 +171,8 @@ message TagKey { // Must be of the form `organizations/{org_id}`. string parent = 2 [(google.api.field_behavior) = IMMUTABLE]; - // Required. Immutable. The user friendly name for a TagKey. The short name should be - // unique for TagKeys within the same tag namespace. + // Required. Immutable. The user friendly name for a TagKey. The short name + // should be unique for TagKeys within the same tag namespace. // // The short name must be 1-63 characters, beginning and ending with // an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), @@ -175,20 +188,40 @@ message TagKey { (google.api.field_behavior) = IMMUTABLE ]; - // Optional. User-assigned description of the TagKey. Must not exceed 256 characters. + // Optional. User-assigned description of the TagKey. Must not exceed 256 + // characters. // // Read-write. string description = 5 [(google.api.field_behavior) = OPTIONAL]; // Output only. Creation time. - google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Update time. - google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Optional. Entity tag which users can pass to prevent race conditions. This field is - // always set in server responses. See UpdateTagKeyRequest for details. + // Optional. Entity tag which users can pass to prevent race conditions. This + // field is always set in server responses. See UpdateTagKeyRequest for + // details. string etag = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A purpose denotes that this Tag is intended for use in policies + // of a specific policy engine, and will involve that policy engine in + // management operations involving this Tag. A purpose does not grant a + // policy engine exclusive rights to the Tag, and it may be referenced by + // other policy engines. + // + // A purpose cannot be changed once set. + Purpose purpose = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Purpose data corresponds to the policy system that the tag is + // intended for. See documentation for `Purpose` for formatting of this field. + // + // Purpose data cannot be changed once set. + map purpose_data = 12 + [(google.api.field_behavior) = OPTIONAL]; } // The request message for listing all TagKeys under a parent resource. @@ -197,14 +230,12 @@ message ListTagKeysRequest { // Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "*" - } + (google.api.resource_reference) = { child_type: "*" } ]; - // Optional. The maximum number of TagKeys to return in the response. The server allows - // a maximum of 300 TagKeys to return. If unspecified, the server will use 100 - // as the default. + // Optional. The maximum number of TagKeys to return in the response. The + // server allows a maximum of 300 TagKeys to return. If unspecified, the + // server will use 100 as the default. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; // Optional. A pagination token returned from a previous call to `ListTagKey` @@ -234,28 +265,40 @@ message GetTagKeyRequest { ]; } +// The request message for getting a TagKey by its namespaced name. +message GetNamespacedTagKeyRequest { + // Required. A namespaced tag key name in the format + // `{parentId}/{tagKeyShort}`, such as `42/foo` for a key with short name + // "foo" under the organization with ID 42 or `r2-d2/bar` for a key with short + // name "bar" under the project `r2-d2`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/TagKey" + } + ]; +} + // The request message for creating a TagKey. message CreateTagKeyRequest { - // Required. The TagKey to be created. Only fields `short_name`, `description`, - // and `parent` are considered during the creation request. + // Required. The TagKey to be created. Only fields `short_name`, + // `description`, and `parent` are considered during the creation request. TagKey tag_key = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. Set to true to perform validations necessary for creating the resource, but - // not actually perform the action. + // Optional. Set to true to perform validations necessary for creating the + // resource, but not actually perform the action. bool validate_only = 2 [(google.api.field_behavior) = OPTIONAL]; } // Runtime operation information for creating a TagKey. -message CreateTagKeyMetadata { - -} +message CreateTagKeyMetadata {} // The request message for updating a TagKey. message UpdateTagKeyRequest { - // Required. The new definition of the TagKey. Only the `description` and `etag` fields - // can be updated by this request. If the `etag` field is not empty, it - // must match the `etag` field of the existing tag key. Otherwise, - // `FAILED_PRECONDITION` will be returned. + // Required. The new definition of the TagKey. Only the `description` and + // `etag` fields can be updated by this request. If the `etag` field is not + // empty, it must match the `etag` field of the existing tag key. Otherwise, + // `ABORTED` will be returned. TagKey tag_key = 1 [(google.api.field_behavior) = REQUIRED]; // Fields to be updated. The mask may only contain `description` or @@ -269,15 +312,13 @@ message UpdateTagKeyRequest { } // Runtime operation information for updating a TagKey. -message UpdateTagKeyMetadata { - -} +message UpdateTagKeyMetadata {} // The request message for deleting a TagKey. message DeleteTagKeyRequest { - // Required. The resource name of a TagKey to be deleted in the format `tagKeys/123`. - // The TagKey cannot be a parent of any existing TagValues or it will not be - // deleted successfully. + // Required. The resource name of a TagKey to be deleted in the format + // `tagKeys/123`. The TagKey cannot be a parent of any existing TagValues or + // it will not be deleted successfully. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -285,16 +326,35 @@ message DeleteTagKeyRequest { } ]; - // Optional. Set as true to perform validations necessary for deletion, but not actually - // perform the action. + // Optional. Set as true to perform validations necessary for deletion, but + // not actually perform the action. bool validate_only = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The etag known to the client for the expected state of the TagKey. This is - // to be used for optimistic concurrency. + // Optional. The etag known to the client for the expected state of the + // TagKey. This is to be used for optimistic concurrency. string etag = 3 [(google.api.field_behavior) = OPTIONAL]; } // Runtime operation information for deleting a TagKey. -message DeleteTagKeyMetadata { +message DeleteTagKeyMetadata {} +// +// A purpose for each policy engine requiring such an integration. A single +// policy engine may have multiple purposes defined, however a TagKey may only +// specify a single purpose. +enum Purpose { + // Unspecified purpose. + PURPOSE_UNSPECIFIED = 0; + + // Purpose for Compute Engine firewalls. + // A corresponding purpose_data should be set for the network the tag is + // intended for. The key should be 'network' and the value should be in + // either of these two formats: + // -https://www.googleapis.com/compute/{compute_version}/projects/{project_id}/global/networks/{network_id} + // -{project_id}/{network_name} + // + // Examples: + // -https://www.googleapis.com/compute/staging_v1/projects/fail-closed-load-testing/global/networks/6992953698831725600 + // -fail-closed-load-testing/load-testing-network + GCE_FIREWALL = 1; } diff --git a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_values.proto b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_values.proto index 7cace43097ff..f54d63556b98 100644 --- a/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_values.proto +++ b/packages/google-cloud-resourcemanager/protos/google/cloud/resourcemanager/v3/tag_values.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -49,9 +49,8 @@ service TagValues { option (google.api.method_signature) = "parent"; } - // Retrieves TagValue. If the TagValue or namespaced name does not exist, or - // if the user does not have permission to view it, this method will return - // `PERMISSION_DENIED`. + // Retrieves a TagValue. This method will return `PERMISSION_DENIED` if the + // value does not exist or the user does not have permission to view it. rpc GetTagValue(GetTagValueRequest) returns (TagValue) { option (google.api.http) = { get: "/v3/{name=tagValues/*}" @@ -59,11 +58,22 @@ service TagValues { option (google.api.method_signature) = "name"; } + // Retrieves a TagValue by its namespaced name. + // This method will return `PERMISSION_DENIED` if the value does not exist + // or the user does not have permission to view it. + rpc GetNamespacedTagValue(GetNamespacedTagValueRequest) returns (TagValue) { + option (google.api.http) = { + get: "/v3/tagValues/namespaced" + }; + option (google.api.method_signature) = "name"; + } + // Creates a TagValue as a child of the specified TagKey. If a another // request with the same parameters is sent while the original request is in - // process the second request will receive an error. A maximum of 300 + // process the second request will receive an error. A maximum of 1000 // TagValues can exist under a TagKey at any given time. - rpc CreateTagValue(CreateTagValueRequest) returns (google.longrunning.Operation) { + rpc CreateTagValue(CreateTagValueRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v3/tagValues" body: "tag_value" @@ -76,7 +86,8 @@ service TagValues { } // Updates the attributes of the TagValue resource. - rpc UpdateTagValue(UpdateTagValueRequest) returns (google.longrunning.Operation) { + rpc UpdateTagValue(UpdateTagValueRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { patch: "/v3/{tag_value.name=tagValues/*}" body: "tag_value" @@ -90,7 +101,8 @@ service TagValues { // Deletes a TagValue. The TagValue cannot have any bindings when it is // deleted. - rpc DeleteTagValue(DeleteTagValueRequest) returns (google.longrunning.Operation) { + rpc DeleteTagValue(DeleteTagValueRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v3/{name=tagValues/*}" }; @@ -107,7 +119,8 @@ service TagValues { // The caller must have the // `cloudresourcemanager.googleapis.com/tagValues.getIamPolicy` permission on // the identified TagValue to get the access control policy. - 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: "/v3/{resource=tagValues/*}:getIamPolicy" body: "*" @@ -120,7 +133,8 @@ service TagValues { // For example: `tagValues/1234`. // The caller must have `resourcemanager.tagValues.setIamPolicy` permission // on the identified tagValue. - 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: "/v3/{resource=tagValues/*}:setIamPolicy" body: "*" @@ -133,7 +147,8 @@ service TagValues { // `tagValues/1234`. // // There are no permissions required for making this API call. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { option (google.api.http) = { post: "/v3/{resource=tagValues/*}:testIamPermissions" body: "*" @@ -158,8 +173,8 @@ message TagValue { // Must be of the form `tagKeys/{tag_key_id}`. string parent = 2 [(google.api.field_behavior) = IMMUTABLE]; - // Required. Immutable. User-assigned short name for TagValue. The short name should be - // unique for TagValues within the same parent TagKey. + // Required. Immutable. User-assigned short name for TagValue. The short name + // should be unique for TagValues within the same parent TagKey. // // The short name must be 63 characters or less, beginning and ending with // an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), @@ -169,8 +184,10 @@ message TagValue { (google.api.field_behavior) = IMMUTABLE ]; - // Output only. Namespaced name of the TagValue. Must be in the format - // `{organization_id}/{tag_key_short_name}/{short_name}`. + // Output only. Namespaced name of the TagValue. Now only supported in the + // format + // `{organization_id}/{tag_key_short_name}/{short_name}`. Other + // formats will be supported when we add non-org parented tags. string namespaced_name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; // Optional. User-assigned description of the TagValue. @@ -180,34 +197,36 @@ message TagValue { string description = 5 [(google.api.field_behavior) = OPTIONAL]; // Output only. Creation time. - google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Update time. - google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Optional. Entity tag which users can pass to prevent race conditions. This field is - // always set in server responses. See UpdateTagValueRequest for details. + // Optional. Entity tag which users can pass to prevent race conditions. This + // field is always set in server responses. See UpdateTagValueRequest for + // details. string etag = 8 [(google.api.field_behavior) = OPTIONAL]; } // The request message for listing TagValues for the specified TagKey. +// Resource name for TagKey, parent of the TagValues to be listed, +// in the format `tagKeys/123`. message ListTagValuesRequest { - // Required. Resource name for TagKey, parent of the TagValues to be listed, - // in the format `tagKeys/123`. + // Required. string parent = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "*" - } + (google.api.resource_reference) = { child_type: "*" } ]; - // Optional. The maximum number of TagValues to return in the response. The server - // allows a maximum of 300 TagValues to return. If unspecified, the server - // will use 100 as the default. + // Optional. The maximum number of TagValues to return in the response. The + // server allows a maximum of 300 TagValues to return. If unspecified, the + // server will use 100 as the default. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. A pagination token returned from a previous call to `ListTagValues` - // that indicates where this listing should continue from. + // Optional. A pagination token returned from a previous call to + // `ListTagValues` that indicates where this listing should continue from. string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; } @@ -225,7 +244,27 @@ message ListTagValuesResponse { // The request message for getting a TagValue. message GetTagValueRequest { - // Required. Resource name for TagValue to be fetched in the format `tagValues/456`. + // Required. Resource name for TagValue to be fetched in the format + // `tagValues/456`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/TagValue" + } + ]; +} + +// The request message for getting a TagValue by its namespaced name. +message GetNamespacedTagValueRequest { + // Required. A namespaced tag value name in the following format: + // + // `{parentId}/{tagKeyShort}/{tagValueShort}` + // + // Examples: + // - `42/foo/abc` for a value with short name "abc" under the key with short + // name "foo" under the organization with ID 42 + // - `r2-d2/bar/xyz` for a value with short name "xyz" under the key with + // short name "bar" under the project with ID "r2-d2" string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -236,44 +275,42 @@ message GetTagValueRequest { // The request message for creating a TagValue. message CreateTagValueRequest { - // Required. The TagValue to be created. Only fields `short_name`, `description`, - // and `parent` are considered during the creation request. + // Required. The TagValue to be created. Only fields `short_name`, + // `description`, and `parent` are considered during the creation request. TagValue tag_value = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. Set as true to perform the validations necessary for creating the resource, - // but not actually perform the action. + // Optional. Set as true to perform the validations necessary for creating the + // resource, but not actually perform the action. bool validate_only = 2 [(google.api.field_behavior) = OPTIONAL]; } // Runtime operation information for creating a TagValue. -message CreateTagValueMetadata { - -} +message CreateTagValueMetadata {} // The request message for updating a TagValue. message UpdateTagValueRequest { - // Required. The new definition of the TagValue. Only fields `description` and `etag` - // fields can be updated by this request. If the `etag` field is nonempty, it - // must match the `etag` field of the existing ControlGroup. Otherwise, - // `FAILED_PRECONDITION` will be returned. + // Required. The new definition of the TagValue. Only fields `description` and + // `etag` fields can be updated by this request. If the `etag` field is + // nonempty, it must match the `etag` field of the existing ControlGroup. + // Otherwise, `ABORTED` will be returned. TagValue tag_value = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. Fields to be updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = OPTIONAL]; - // Optional. True to perform validations necessary for updating the resource, but not - // actually perform the action. + // Optional. True to perform validations necessary for updating the resource, + // but not actually perform the action. bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL]; } // Runtime operation information for updating a TagValue. -message UpdateTagValueMetadata { - -} +message UpdateTagValueMetadata {} // The request message for deleting a TagValue. message DeleteTagValueRequest { - // Required. Resource name for TagValue to be deleted in the format tagValues/456. + // Required. Resource name for TagValue to be deleted in the format + // tagValues/456. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -281,16 +318,14 @@ message DeleteTagValueRequest { } ]; - // Optional. Set as true to perform the validations necessary for deletion, but not - // actually perform the action. + // Optional. Set as true to perform the validations necessary for deletion, + // but not actually perform the action. bool validate_only = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The etag known to the client for the expected state of the TagValue. This - // is to be used for optimistic concurrency. + // Optional. The etag known to the client for the expected state of the + // TagValue. This is to be used for optimistic concurrency. string etag = 3 [(google.api.field_behavior) = OPTIONAL]; } // Runtime operation information for deleting a TagValue. -message DeleteTagValueMetadata { - -} +message DeleteTagValueMetadata {} diff --git a/packages/google-cloud-resourcemanager/protos/protos.d.ts b/packages/google-cloud-resourcemanager/protos/protos.d.ts index 16435fa8c8fe..8cf4a116fafd 100644 --- a/packages/google-cloud-resourcemanager/protos/protos.d.ts +++ b/packages/google-cloud-resourcemanager/protos/protos.d.ts @@ -4685,6 +4685,20 @@ export namespace google { * @returns Promise */ public deleteTagBinding(request: google.cloud.resourcemanager.v3.IDeleteTagBindingRequest): Promise; + + /** + * Calls ListEffectiveTags. + * @param request ListEffectiveTagsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListEffectiveTagsResponse + */ + public listEffectiveTags(request: google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, callback: google.cloud.resourcemanager.v3.TagBindings.ListEffectiveTagsCallback): void; + + /** + * Calls ListEffectiveTags. + * @param request ListEffectiveTagsRequest message or plain object + * @returns Promise + */ + public listEffectiveTags(request: google.cloud.resourcemanager.v3.IListEffectiveTagsRequest): Promise; } namespace TagBindings { @@ -4709,6 +4723,13 @@ export namespace google { * @param [response] Operation */ type DeleteTagBindingCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagBindings|listEffectiveTags}. + * @param error Error, if any + * @param [response] ListEffectiveTagsResponse + */ + type ListEffectiveTagsCallback = (error: (Error|null), response?: google.cloud.resourcemanager.v3.ListEffectiveTagsResponse) => void; } /** Properties of a TagBinding. */ @@ -4722,6 +4743,9 @@ export namespace google { /** TagBinding tagValue */ tagValue?: (string|null); + + /** TagBinding tagValueNamespacedName */ + tagValueNamespacedName?: (string|null); } /** Represents a TagBinding. */ @@ -4742,6 +4766,9 @@ export namespace google { /** TagBinding tagValue. */ public tagValue: string; + /** TagBinding tagValueNamespacedName. */ + public tagValueNamespacedName: string; + /** * Creates a new TagBinding instance using the specified properties. * @param [properties] Properties to set @@ -5137,277 +5164,1436 @@ export namespace google { * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.resourcemanager.v3.IDeleteTagBindingRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.resourcemanager.v3.IDeleteTagBindingRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteTagBindingRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagBindingRequest.verify|verify} messages. + * @param message DeleteTagBindingRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IDeleteTagBindingRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteTagBindingRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteTagBindingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.DeleteTagBindingRequest; + + /** + * Decodes a DeleteTagBindingRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteTagBindingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.DeleteTagBindingRequest; + + /** + * Verifies a DeleteTagBindingRequest 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 DeleteTagBindingRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteTagBindingRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.DeleteTagBindingRequest; + + /** + * Creates a plain object from a DeleteTagBindingRequest message. Also converts values to other types if specified. + * @param message DeleteTagBindingRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.DeleteTagBindingRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteTagBindingRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteTagBindingRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListTagBindingsRequest. */ + interface IListTagBindingsRequest { + + /** ListTagBindingsRequest parent */ + parent?: (string|null); + + /** ListTagBindingsRequest pageSize */ + pageSize?: (number|null); + + /** ListTagBindingsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListTagBindingsRequest. */ + class ListTagBindingsRequest implements IListTagBindingsRequest { + + /** + * Constructs a new ListTagBindingsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.IListTagBindingsRequest); + + /** ListTagBindingsRequest parent. */ + public parent: string; + + /** ListTagBindingsRequest pageSize. */ + public pageSize: number; + + /** ListTagBindingsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListTagBindingsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListTagBindingsRequest instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.IListTagBindingsRequest): google.cloud.resourcemanager.v3.ListTagBindingsRequest; + + /** + * Encodes the specified ListTagBindingsRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagBindingsRequest.verify|verify} messages. + * @param message ListTagBindingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.IListTagBindingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListTagBindingsRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagBindingsRequest.verify|verify} messages. + * @param message ListTagBindingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IListTagBindingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListTagBindingsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListTagBindingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.ListTagBindingsRequest; + + /** + * Decodes a ListTagBindingsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListTagBindingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.ListTagBindingsRequest; + + /** + * Verifies a ListTagBindingsRequest 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 ListTagBindingsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListTagBindingsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.ListTagBindingsRequest; + + /** + * Creates a plain object from a ListTagBindingsRequest message. Also converts values to other types if specified. + * @param message ListTagBindingsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.ListTagBindingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListTagBindingsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListTagBindingsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListTagBindingsResponse. */ + interface IListTagBindingsResponse { + + /** ListTagBindingsResponse tagBindings */ + tagBindings?: (google.cloud.resourcemanager.v3.ITagBinding[]|null); + + /** ListTagBindingsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListTagBindingsResponse. */ + class ListTagBindingsResponse implements IListTagBindingsResponse { + + /** + * Constructs a new ListTagBindingsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.IListTagBindingsResponse); + + /** ListTagBindingsResponse tagBindings. */ + public tagBindings: google.cloud.resourcemanager.v3.ITagBinding[]; + + /** ListTagBindingsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListTagBindingsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListTagBindingsResponse instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.IListTagBindingsResponse): google.cloud.resourcemanager.v3.ListTagBindingsResponse; + + /** + * Encodes the specified ListTagBindingsResponse message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagBindingsResponse.verify|verify} messages. + * @param message ListTagBindingsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.IListTagBindingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListTagBindingsResponse message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagBindingsResponse.verify|verify} messages. + * @param message ListTagBindingsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IListTagBindingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListTagBindingsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListTagBindingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.ListTagBindingsResponse; + + /** + * Decodes a ListTagBindingsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListTagBindingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.ListTagBindingsResponse; + + /** + * Verifies a ListTagBindingsResponse 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 ListTagBindingsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListTagBindingsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.ListTagBindingsResponse; + + /** + * Creates a plain object from a ListTagBindingsResponse message. Also converts values to other types if specified. + * @param message ListTagBindingsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.ListTagBindingsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListTagBindingsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListTagBindingsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEffectiveTagsRequest. */ + interface IListEffectiveTagsRequest { + + /** ListEffectiveTagsRequest parent */ + parent?: (string|null); + + /** ListEffectiveTagsRequest pageSize */ + pageSize?: (number|null); + + /** ListEffectiveTagsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListEffectiveTagsRequest. */ + class ListEffectiveTagsRequest implements IListEffectiveTagsRequest { + + /** + * Constructs a new ListEffectiveTagsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.IListEffectiveTagsRequest); + + /** ListEffectiveTagsRequest parent. */ + public parent: string; + + /** ListEffectiveTagsRequest pageSize. */ + public pageSize: number; + + /** ListEffectiveTagsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListEffectiveTagsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEffectiveTagsRequest instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.IListEffectiveTagsRequest): google.cloud.resourcemanager.v3.ListEffectiveTagsRequest; + + /** + * Encodes the specified ListEffectiveTagsRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListEffectiveTagsRequest.verify|verify} messages. + * @param message ListEffectiveTagsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEffectiveTagsRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListEffectiveTagsRequest.verify|verify} messages. + * @param message ListEffectiveTagsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEffectiveTagsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEffectiveTagsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.ListEffectiveTagsRequest; + + /** + * Decodes a ListEffectiveTagsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEffectiveTagsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.ListEffectiveTagsRequest; + + /** + * Verifies a ListEffectiveTagsRequest 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 ListEffectiveTagsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEffectiveTagsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.ListEffectiveTagsRequest; + + /** + * Creates a plain object from a ListEffectiveTagsRequest message. Also converts values to other types if specified. + * @param message ListEffectiveTagsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.ListEffectiveTagsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEffectiveTagsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEffectiveTagsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEffectiveTagsResponse. */ + interface IListEffectiveTagsResponse { + + /** ListEffectiveTagsResponse effectiveTags */ + effectiveTags?: (google.cloud.resourcemanager.v3.IEffectiveTag[]|null); + + /** ListEffectiveTagsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListEffectiveTagsResponse. */ + class ListEffectiveTagsResponse implements IListEffectiveTagsResponse { + + /** + * Constructs a new ListEffectiveTagsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.IListEffectiveTagsResponse); + + /** ListEffectiveTagsResponse effectiveTags. */ + public effectiveTags: google.cloud.resourcemanager.v3.IEffectiveTag[]; + + /** ListEffectiveTagsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListEffectiveTagsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEffectiveTagsResponse instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.IListEffectiveTagsResponse): google.cloud.resourcemanager.v3.ListEffectiveTagsResponse; + + /** + * Encodes the specified ListEffectiveTagsResponse message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListEffectiveTagsResponse.verify|verify} messages. + * @param message ListEffectiveTagsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.IListEffectiveTagsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEffectiveTagsResponse message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListEffectiveTagsResponse.verify|verify} messages. + * @param message ListEffectiveTagsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IListEffectiveTagsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEffectiveTagsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEffectiveTagsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.ListEffectiveTagsResponse; + + /** + * Decodes a ListEffectiveTagsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEffectiveTagsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.ListEffectiveTagsResponse; + + /** + * Verifies a ListEffectiveTagsResponse 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 ListEffectiveTagsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEffectiveTagsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.ListEffectiveTagsResponse; + + /** + * Creates a plain object from a ListEffectiveTagsResponse message. Also converts values to other types if specified. + * @param message ListEffectiveTagsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.ListEffectiveTagsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEffectiveTagsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEffectiveTagsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EffectiveTag. */ + interface IEffectiveTag { + + /** EffectiveTag tagValue */ + tagValue?: (string|null); + + /** EffectiveTag namespacedTagValue */ + namespacedTagValue?: (string|null); + + /** EffectiveTag tagKey */ + tagKey?: (string|null); + + /** EffectiveTag namespacedTagKey */ + namespacedTagKey?: (string|null); + + /** EffectiveTag tagKeyParentName */ + tagKeyParentName?: (string|null); + + /** EffectiveTag inherited */ + inherited?: (boolean|null); + } + + /** Represents an EffectiveTag. */ + class EffectiveTag implements IEffectiveTag { + + /** + * Constructs a new EffectiveTag. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.IEffectiveTag); + + /** EffectiveTag tagValue. */ + public tagValue: string; + + /** EffectiveTag namespacedTagValue. */ + public namespacedTagValue: string; + + /** EffectiveTag tagKey. */ + public tagKey: string; + + /** EffectiveTag namespacedTagKey. */ + public namespacedTagKey: string; + + /** EffectiveTag tagKeyParentName. */ + public tagKeyParentName: string; + + /** EffectiveTag inherited. */ + public inherited: boolean; + + /** + * Creates a new EffectiveTag instance using the specified properties. + * @param [properties] Properties to set + * @returns EffectiveTag instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.IEffectiveTag): google.cloud.resourcemanager.v3.EffectiveTag; + + /** + * Encodes the specified EffectiveTag message. Does not implicitly {@link google.cloud.resourcemanager.v3.EffectiveTag.verify|verify} messages. + * @param message EffectiveTag message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.IEffectiveTag, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EffectiveTag message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.EffectiveTag.verify|verify} messages. + * @param message EffectiveTag message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IEffectiveTag, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EffectiveTag message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EffectiveTag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.EffectiveTag; + + /** + * Decodes an EffectiveTag message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EffectiveTag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.EffectiveTag; + + /** + * Verifies an EffectiveTag 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 EffectiveTag message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EffectiveTag + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.EffectiveTag; + + /** + * Creates a plain object from an EffectiveTag message. Also converts values to other types if specified. + * @param message EffectiveTag + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.EffectiveTag, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EffectiveTag to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EffectiveTag + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a TagHolds */ + class TagHolds extends $protobuf.rpc.Service { + + /** + * Constructs a new TagHolds service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new TagHolds service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): TagHolds; + + /** + * Calls CreateTagHold. + * @param request CreateTagHoldRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createTagHold(request: google.cloud.resourcemanager.v3.ICreateTagHoldRequest, callback: google.cloud.resourcemanager.v3.TagHolds.CreateTagHoldCallback): void; + + /** + * Calls CreateTagHold. + * @param request CreateTagHoldRequest message or plain object + * @returns Promise + */ + public createTagHold(request: google.cloud.resourcemanager.v3.ICreateTagHoldRequest): Promise; + + /** + * Calls DeleteTagHold. + * @param request DeleteTagHoldRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteTagHold(request: google.cloud.resourcemanager.v3.IDeleteTagHoldRequest, callback: google.cloud.resourcemanager.v3.TagHolds.DeleteTagHoldCallback): void; + + /** + * Calls DeleteTagHold. + * @param request DeleteTagHoldRequest message or plain object + * @returns Promise + */ + public deleteTagHold(request: google.cloud.resourcemanager.v3.IDeleteTagHoldRequest): Promise; + + /** + * Calls ListTagHolds. + * @param request ListTagHoldsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListTagHoldsResponse + */ + public listTagHolds(request: google.cloud.resourcemanager.v3.IListTagHoldsRequest, callback: google.cloud.resourcemanager.v3.TagHolds.ListTagHoldsCallback): void; + + /** + * Calls ListTagHolds. + * @param request ListTagHoldsRequest message or plain object + * @returns Promise + */ + public listTagHolds(request: google.cloud.resourcemanager.v3.IListTagHoldsRequest): Promise; + } + + namespace TagHolds { + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagHolds|createTagHold}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateTagHoldCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagHolds|deleteTagHold}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteTagHoldCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagHolds|listTagHolds}. + * @param error Error, if any + * @param [response] ListTagHoldsResponse + */ + type ListTagHoldsCallback = (error: (Error|null), response?: google.cloud.resourcemanager.v3.ListTagHoldsResponse) => void; + } + + /** Properties of a TagHold. */ + interface ITagHold { + + /** TagHold name */ + name?: (string|null); + + /** TagHold holder */ + holder?: (string|null); + + /** TagHold origin */ + origin?: (string|null); + + /** TagHold helpLink */ + helpLink?: (string|null); + + /** TagHold createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a TagHold. */ + class TagHold implements ITagHold { + + /** + * Constructs a new TagHold. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.ITagHold); + + /** TagHold name. */ + public name: string; + + /** TagHold holder. */ + public holder: string; + + /** TagHold origin. */ + public origin: string; + + /** TagHold helpLink. */ + public helpLink: string; + + /** TagHold createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new TagHold instance using the specified properties. + * @param [properties] Properties to set + * @returns TagHold instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.ITagHold): google.cloud.resourcemanager.v3.TagHold; + + /** + * Encodes the specified TagHold message. Does not implicitly {@link google.cloud.resourcemanager.v3.TagHold.verify|verify} messages. + * @param message TagHold message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.ITagHold, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TagHold message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.TagHold.verify|verify} messages. + * @param message TagHold message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.ITagHold, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TagHold message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TagHold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.TagHold; + + /** + * Decodes a TagHold message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TagHold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.TagHold; + + /** + * Verifies a TagHold 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 TagHold message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TagHold + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.TagHold; + + /** + * Creates a plain object from a TagHold message. Also converts values to other types if specified. + * @param message TagHold + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.TagHold, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TagHold to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TagHold + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateTagHoldRequest. */ + interface ICreateTagHoldRequest { + + /** CreateTagHoldRequest parent */ + parent?: (string|null); + + /** CreateTagHoldRequest tagHold */ + tagHold?: (google.cloud.resourcemanager.v3.ITagHold|null); + + /** CreateTagHoldRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a CreateTagHoldRequest. */ + class CreateTagHoldRequest implements ICreateTagHoldRequest { + + /** + * Constructs a new CreateTagHoldRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.ICreateTagHoldRequest); + + /** CreateTagHoldRequest parent. */ + public parent: string; + + /** CreateTagHoldRequest tagHold. */ + public tagHold?: (google.cloud.resourcemanager.v3.ITagHold|null); + + /** CreateTagHoldRequest validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new CreateTagHoldRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateTagHoldRequest instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.ICreateTagHoldRequest): google.cloud.resourcemanager.v3.CreateTagHoldRequest; + + /** + * Encodes the specified CreateTagHoldRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.CreateTagHoldRequest.verify|verify} messages. + * @param message CreateTagHoldRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.ICreateTagHoldRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateTagHoldRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.CreateTagHoldRequest.verify|verify} messages. + * @param message CreateTagHoldRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.ICreateTagHoldRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateTagHoldRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateTagHoldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.CreateTagHoldRequest; + + /** + * Decodes a CreateTagHoldRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateTagHoldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.CreateTagHoldRequest; + + /** + * Verifies a CreateTagHoldRequest 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 CreateTagHoldRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateTagHoldRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.CreateTagHoldRequest; + + /** + * Creates a plain object from a CreateTagHoldRequest message. Also converts values to other types if specified. + * @param message CreateTagHoldRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.CreateTagHoldRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateTagHoldRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateTagHoldRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateTagHoldMetadata. */ + interface ICreateTagHoldMetadata { + } + + /** Represents a CreateTagHoldMetadata. */ + class CreateTagHoldMetadata implements ICreateTagHoldMetadata { + + /** + * Constructs a new CreateTagHoldMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.ICreateTagHoldMetadata); + + /** + * Creates a new CreateTagHoldMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateTagHoldMetadata instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.ICreateTagHoldMetadata): google.cloud.resourcemanager.v3.CreateTagHoldMetadata; + + /** + * Encodes the specified CreateTagHoldMetadata message. Does not implicitly {@link google.cloud.resourcemanager.v3.CreateTagHoldMetadata.verify|verify} messages. + * @param message CreateTagHoldMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.ICreateTagHoldMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateTagHoldMetadata message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.CreateTagHoldMetadata.verify|verify} messages. + * @param message CreateTagHoldMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.ICreateTagHoldMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateTagHoldMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateTagHoldMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.CreateTagHoldMetadata; + + /** + * Decodes a CreateTagHoldMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateTagHoldMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.CreateTagHoldMetadata; + + /** + * Verifies a CreateTagHoldMetadata 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 CreateTagHoldMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateTagHoldMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.CreateTagHoldMetadata; + + /** + * Creates a plain object from a CreateTagHoldMetadata message. Also converts values to other types if specified. + * @param message CreateTagHoldMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.CreateTagHoldMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateTagHoldMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateTagHoldMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteTagHoldRequest. */ + interface IDeleteTagHoldRequest { + + /** DeleteTagHoldRequest name */ + name?: (string|null); + + /** DeleteTagHoldRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a DeleteTagHoldRequest. */ + class DeleteTagHoldRequest implements IDeleteTagHoldRequest { + + /** + * Constructs a new DeleteTagHoldRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.IDeleteTagHoldRequest); + + /** DeleteTagHoldRequest name. */ + public name: string; + + /** DeleteTagHoldRequest validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new DeleteTagHoldRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteTagHoldRequest instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.IDeleteTagHoldRequest): google.cloud.resourcemanager.v3.DeleteTagHoldRequest; + + /** + * Encodes the specified DeleteTagHoldRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagHoldRequest.verify|verify} messages. + * @param message DeleteTagHoldRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.IDeleteTagHoldRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteTagHoldRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagHoldRequest.verify|verify} messages. + * @param message DeleteTagHoldRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IDeleteTagHoldRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteTagHoldRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteTagHoldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.DeleteTagHoldRequest; + + /** + * Decodes a DeleteTagHoldRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteTagHoldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.DeleteTagHoldRequest; + + /** + * Verifies a DeleteTagHoldRequest 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 DeleteTagHoldRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteTagHoldRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.DeleteTagHoldRequest; + + /** + * Creates a plain object from a DeleteTagHoldRequest message. Also converts values to other types if specified. + * @param message DeleteTagHoldRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.DeleteTagHoldRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteTagHoldRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteTagHoldRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteTagHoldMetadata. */ + interface IDeleteTagHoldMetadata { + } + + /** Represents a DeleteTagHoldMetadata. */ + class DeleteTagHoldMetadata implements IDeleteTagHoldMetadata { + + /** + * Constructs a new DeleteTagHoldMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata); + + /** + * Creates a new DeleteTagHoldMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteTagHoldMetadata instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata): google.cloud.resourcemanager.v3.DeleteTagHoldMetadata; + + /** + * Encodes the specified DeleteTagHoldMetadata message. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagHoldMetadata.verify|verify} messages. + * @param message DeleteTagHoldMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteTagBindingRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagBindingRequest.verify|verify} messages. - * @param message DeleteTagBindingRequest message or plain object to encode + * Encodes the specified DeleteTagHoldMetadata message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagHoldMetadata.verify|verify} messages. + * @param message DeleteTagHoldMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.resourcemanager.v3.IDeleteTagBindingRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteTagBindingRequest message from the specified reader or buffer. + * Decodes a DeleteTagHoldMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteTagBindingRequest + * @returns DeleteTagHoldMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.DeleteTagBindingRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.DeleteTagHoldMetadata; /** - * Decodes a DeleteTagBindingRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteTagHoldMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteTagBindingRequest + * @returns DeleteTagHoldMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.DeleteTagBindingRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.DeleteTagHoldMetadata; /** - * Verifies a DeleteTagBindingRequest message. + * Verifies a DeleteTagHoldMetadata 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 DeleteTagBindingRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteTagHoldMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteTagBindingRequest + * @returns DeleteTagHoldMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.DeleteTagBindingRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.DeleteTagHoldMetadata; /** - * Creates a plain object from a DeleteTagBindingRequest message. Also converts values to other types if specified. - * @param message DeleteTagBindingRequest + * Creates a plain object from a DeleteTagHoldMetadata message. Also converts values to other types if specified. + * @param message DeleteTagHoldMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.resourcemanager.v3.DeleteTagBindingRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.resourcemanager.v3.DeleteTagHoldMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteTagBindingRequest to JSON. + * Converts this DeleteTagHoldMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for DeleteTagBindingRequest + * Gets the default type url for DeleteTagHoldMetadata * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ListTagBindingsRequest. */ - interface IListTagBindingsRequest { + /** Properties of a ListTagHoldsRequest. */ + interface IListTagHoldsRequest { - /** ListTagBindingsRequest parent */ + /** ListTagHoldsRequest parent */ parent?: (string|null); - /** ListTagBindingsRequest pageSize */ + /** ListTagHoldsRequest pageSize */ pageSize?: (number|null); - /** ListTagBindingsRequest pageToken */ + /** ListTagHoldsRequest pageToken */ pageToken?: (string|null); + + /** ListTagHoldsRequest filter */ + filter?: (string|null); } - /** Represents a ListTagBindingsRequest. */ - class ListTagBindingsRequest implements IListTagBindingsRequest { + /** Represents a ListTagHoldsRequest. */ + class ListTagHoldsRequest implements IListTagHoldsRequest { /** - * Constructs a new ListTagBindingsRequest. + * Constructs a new ListTagHoldsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.resourcemanager.v3.IListTagBindingsRequest); + constructor(properties?: google.cloud.resourcemanager.v3.IListTagHoldsRequest); - /** ListTagBindingsRequest parent. */ + /** ListTagHoldsRequest parent. */ public parent: string; - /** ListTagBindingsRequest pageSize. */ + /** ListTagHoldsRequest pageSize. */ public pageSize: number; - /** ListTagBindingsRequest pageToken. */ + /** ListTagHoldsRequest pageToken. */ public pageToken: string; + /** ListTagHoldsRequest filter. */ + public filter: string; + /** - * Creates a new ListTagBindingsRequest instance using the specified properties. + * Creates a new ListTagHoldsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ListTagBindingsRequest instance + * @returns ListTagHoldsRequest instance */ - public static create(properties?: google.cloud.resourcemanager.v3.IListTagBindingsRequest): google.cloud.resourcemanager.v3.ListTagBindingsRequest; + public static create(properties?: google.cloud.resourcemanager.v3.IListTagHoldsRequest): google.cloud.resourcemanager.v3.ListTagHoldsRequest; /** - * Encodes the specified ListTagBindingsRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagBindingsRequest.verify|verify} messages. - * @param message ListTagBindingsRequest message or plain object to encode + * Encodes the specified ListTagHoldsRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagHoldsRequest.verify|verify} messages. + * @param message ListTagHoldsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.resourcemanager.v3.IListTagBindingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.resourcemanager.v3.IListTagHoldsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListTagBindingsRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagBindingsRequest.verify|verify} messages. - * @param message ListTagBindingsRequest message or plain object to encode + * Encodes the specified ListTagHoldsRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagHoldsRequest.verify|verify} messages. + * @param message ListTagHoldsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.resourcemanager.v3.IListTagBindingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IListTagHoldsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListTagBindingsRequest message from the specified reader or buffer. + * Decodes a ListTagHoldsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListTagBindingsRequest + * @returns ListTagHoldsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.ListTagBindingsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.ListTagHoldsRequest; /** - * Decodes a ListTagBindingsRequest message from the specified reader or buffer, length delimited. + * Decodes a ListTagHoldsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListTagBindingsRequest + * @returns ListTagHoldsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.ListTagBindingsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.ListTagHoldsRequest; /** - * Verifies a ListTagBindingsRequest message. + * Verifies a ListTagHoldsRequest 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 ListTagBindingsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListTagHoldsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListTagBindingsRequest + * @returns ListTagHoldsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.ListTagBindingsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.ListTagHoldsRequest; /** - * Creates a plain object from a ListTagBindingsRequest message. Also converts values to other types if specified. - * @param message ListTagBindingsRequest + * Creates a plain object from a ListTagHoldsRequest message. Also converts values to other types if specified. + * @param message ListTagHoldsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.resourcemanager.v3.ListTagBindingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.resourcemanager.v3.ListTagHoldsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListTagBindingsRequest to JSON. + * Converts this ListTagHoldsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ListTagBindingsRequest + * Gets the default type url for ListTagHoldsRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ListTagBindingsResponse. */ - interface IListTagBindingsResponse { + /** Properties of a ListTagHoldsResponse. */ + interface IListTagHoldsResponse { - /** ListTagBindingsResponse tagBindings */ - tagBindings?: (google.cloud.resourcemanager.v3.ITagBinding[]|null); + /** ListTagHoldsResponse tagHolds */ + tagHolds?: (google.cloud.resourcemanager.v3.ITagHold[]|null); - /** ListTagBindingsResponse nextPageToken */ + /** ListTagHoldsResponse nextPageToken */ nextPageToken?: (string|null); } - /** Represents a ListTagBindingsResponse. */ - class ListTagBindingsResponse implements IListTagBindingsResponse { + /** Represents a ListTagHoldsResponse. */ + class ListTagHoldsResponse implements IListTagHoldsResponse { /** - * Constructs a new ListTagBindingsResponse. + * Constructs a new ListTagHoldsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.resourcemanager.v3.IListTagBindingsResponse); + constructor(properties?: google.cloud.resourcemanager.v3.IListTagHoldsResponse); - /** ListTagBindingsResponse tagBindings. */ - public tagBindings: google.cloud.resourcemanager.v3.ITagBinding[]; + /** ListTagHoldsResponse tagHolds. */ + public tagHolds: google.cloud.resourcemanager.v3.ITagHold[]; - /** ListTagBindingsResponse nextPageToken. */ + /** ListTagHoldsResponse nextPageToken. */ public nextPageToken: string; /** - * Creates a new ListTagBindingsResponse instance using the specified properties. + * Creates a new ListTagHoldsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ListTagBindingsResponse instance + * @returns ListTagHoldsResponse instance */ - public static create(properties?: google.cloud.resourcemanager.v3.IListTagBindingsResponse): google.cloud.resourcemanager.v3.ListTagBindingsResponse; + public static create(properties?: google.cloud.resourcemanager.v3.IListTagHoldsResponse): google.cloud.resourcemanager.v3.ListTagHoldsResponse; /** - * Encodes the specified ListTagBindingsResponse message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagBindingsResponse.verify|verify} messages. - * @param message ListTagBindingsResponse message or plain object to encode + * Encodes the specified ListTagHoldsResponse message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagHoldsResponse.verify|verify} messages. + * @param message ListTagHoldsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.resourcemanager.v3.IListTagBindingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.resourcemanager.v3.IListTagHoldsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListTagBindingsResponse message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagBindingsResponse.verify|verify} messages. - * @param message ListTagBindingsResponse message or plain object to encode + * Encodes the specified ListTagHoldsResponse message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagHoldsResponse.verify|verify} messages. + * @param message ListTagHoldsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.resourcemanager.v3.IListTagBindingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IListTagHoldsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListTagBindingsResponse message from the specified reader or buffer. + * Decodes a ListTagHoldsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListTagBindingsResponse + * @returns ListTagHoldsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.ListTagBindingsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.ListTagHoldsResponse; /** - * Decodes a ListTagBindingsResponse message from the specified reader or buffer, length delimited. + * Decodes a ListTagHoldsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListTagBindingsResponse + * @returns ListTagHoldsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.ListTagBindingsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.ListTagHoldsResponse; /** - * Verifies a ListTagBindingsResponse message. + * Verifies a ListTagHoldsResponse 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 ListTagBindingsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListTagHoldsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListTagBindingsResponse + * @returns ListTagHoldsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.ListTagBindingsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.ListTagHoldsResponse; /** - * Creates a plain object from a ListTagBindingsResponse message. Also converts values to other types if specified. - * @param message ListTagBindingsResponse + * Creates a plain object from a ListTagHoldsResponse message. Also converts values to other types if specified. + * @param message ListTagHoldsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.resourcemanager.v3.ListTagBindingsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.resourcemanager.v3.ListTagHoldsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListTagBindingsResponse to JSON. + * Converts this ListTagHoldsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ListTagBindingsResponse + * Gets the default type url for ListTagHoldsResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ @@ -5462,6 +6648,20 @@ export namespace google { */ public getTagKey(request: google.cloud.resourcemanager.v3.IGetTagKeyRequest): Promise; + /** + * Calls GetNamespacedTagKey. + * @param request GetNamespacedTagKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TagKey + */ + public getNamespacedTagKey(request: google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest, callback: google.cloud.resourcemanager.v3.TagKeys.GetNamespacedTagKeyCallback): void; + + /** + * Calls GetNamespacedTagKey. + * @param request GetNamespacedTagKeyRequest message or plain object + * @returns Promise + */ + public getNamespacedTagKey(request: google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest): Promise; + /** * Calls CreateTagKey. * @param request CreateTagKeyRequest message or plain object @@ -5563,6 +6763,13 @@ export namespace google { */ type GetTagKeyCallback = (error: (Error|null), response?: google.cloud.resourcemanager.v3.TagKey) => void; + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|getNamespacedTagKey}. + * @param error Error, if any + * @param [response] TagKey + */ + type GetNamespacedTagKeyCallback = (error: (Error|null), response?: google.cloud.resourcemanager.v3.TagKey) => void; + /** * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|createTagKey}. * @param error Error, if any @@ -5632,6 +6839,12 @@ export namespace google { /** TagKey etag */ etag?: (string|null); + + /** TagKey purpose */ + purpose?: (google.cloud.resourcemanager.v3.Purpose|keyof typeof google.cloud.resourcemanager.v3.Purpose|null); + + /** TagKey purposeData */ + purposeData?: ({ [k: string]: string }|null); } /** Represents a TagKey. */ @@ -5667,6 +6880,12 @@ export namespace google { /** TagKey etag. */ public etag: string; + /** TagKey purpose. */ + public purpose: (google.cloud.resourcemanager.v3.Purpose|keyof typeof google.cloud.resourcemanager.v3.Purpose); + + /** TagKey purposeData. */ + public purposeData: { [k: string]: string }; + /** * Creates a new TagKey instance using the specified properties. * @param [properties] Properties to set @@ -6054,6 +7273,103 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a GetNamespacedTagKeyRequest. */ + interface IGetNamespacedTagKeyRequest { + + /** GetNamespacedTagKeyRequest name */ + name?: (string|null); + } + + /** Represents a GetNamespacedTagKeyRequest. */ + class GetNamespacedTagKeyRequest implements IGetNamespacedTagKeyRequest { + + /** + * Constructs a new GetNamespacedTagKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest); + + /** GetNamespacedTagKeyRequest name. */ + public name: string; + + /** + * Creates a new GetNamespacedTagKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetNamespacedTagKeyRequest instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest): google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest; + + /** + * Encodes the specified GetNamespacedTagKeyRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest.verify|verify} messages. + * @param message GetNamespacedTagKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetNamespacedTagKeyRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest.verify|verify} messages. + * @param message GetNamespacedTagKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetNamespacedTagKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetNamespacedTagKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest; + + /** + * Decodes a GetNamespacedTagKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetNamespacedTagKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest; + + /** + * Verifies a GetNamespacedTagKeyRequest 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 GetNamespacedTagKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetNamespacedTagKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest; + + /** + * Creates a plain object from a GetNamespacedTagKeyRequest message. Also converts values to other types if specified. + * @param message GetNamespacedTagKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetNamespacedTagKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetNamespacedTagKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a CreateTagKeyRequest. */ interface ICreateTagKeyRequest { @@ -6648,6 +7964,12 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Purpose enum. */ + enum Purpose { + PURPOSE_UNSPECIFIED = 0, + GCE_FIREWALL = 1 + } + /** Represents a TagValues */ class TagValues extends $protobuf.rpc.Service { @@ -6696,6 +8018,20 @@ export namespace google { */ public getTagValue(request: google.cloud.resourcemanager.v3.IGetTagValueRequest): Promise; + /** + * Calls GetNamespacedTagValue. + * @param request GetNamespacedTagValueRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TagValue + */ + public getNamespacedTagValue(request: google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest, callback: google.cloud.resourcemanager.v3.TagValues.GetNamespacedTagValueCallback): void; + + /** + * Calls GetNamespacedTagValue. + * @param request GetNamespacedTagValueRequest message or plain object + * @returns Promise + */ + public getNamespacedTagValue(request: google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest): Promise; + /** * Calls CreateTagValue. * @param request CreateTagValueRequest message or plain object @@ -6797,6 +8133,13 @@ export namespace google { */ type GetTagValueCallback = (error: (Error|null), response?: google.cloud.resourcemanager.v3.TagValue) => void; + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagValues|getNamespacedTagValue}. + * @param error Error, if any + * @param [response] TagValue + */ + type GetNamespacedTagValueCallback = (error: (Error|null), response?: google.cloud.resourcemanager.v3.TagValue) => void; + /** * Callback as used by {@link google.cloud.resourcemanager.v3.TagValues|createTagValue}. * @param error Error, if any @@ -7288,6 +8631,103 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a GetNamespacedTagValueRequest. */ + interface IGetNamespacedTagValueRequest { + + /** GetNamespacedTagValueRequest name */ + name?: (string|null); + } + + /** Represents a GetNamespacedTagValueRequest. */ + class GetNamespacedTagValueRequest implements IGetNamespacedTagValueRequest { + + /** + * Constructs a new GetNamespacedTagValueRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest); + + /** GetNamespacedTagValueRequest name. */ + public name: string; + + /** + * Creates a new GetNamespacedTagValueRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetNamespacedTagValueRequest instance + */ + public static create(properties?: google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest): google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest; + + /** + * Encodes the specified GetNamespacedTagValueRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest.verify|verify} messages. + * @param message GetNamespacedTagValueRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetNamespacedTagValueRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest.verify|verify} messages. + * @param message GetNamespacedTagValueRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetNamespacedTagValueRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetNamespacedTagValueRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest; + + /** + * Decodes a GetNamespacedTagValueRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetNamespacedTagValueRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest; + + /** + * Verifies a GetNamespacedTagValueRequest 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 GetNamespacedTagValueRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetNamespacedTagValueRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest; + + /** + * Creates a plain object from a GetNamespacedTagValueRequest message. Also converts values to other types if specified. + * @param message GetNamespacedTagValueRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetNamespacedTagValueRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetNamespacedTagValueRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a CreateTagValueRequest. */ interface ICreateTagValueRequest { diff --git a/packages/google-cloud-resourcemanager/protos/protos.js b/packages/google-cloud-resourcemanager/protos/protos.js index 400f0879504b..3f7dc8b47d6a 100644 --- a/packages/google-cloud-resourcemanager/protos/protos.js +++ b/packages/google-cloud-resourcemanager/protos/protos.js @@ -10162,6 +10162,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagBindings|listEffectiveTags}. + * @memberof google.cloud.resourcemanager.v3.TagBindings + * @typedef ListEffectiveTagsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.resourcemanager.v3.ListEffectiveTagsResponse} [response] ListEffectiveTagsResponse + */ + + /** + * Calls ListEffectiveTags. + * @function listEffectiveTags + * @memberof google.cloud.resourcemanager.v3.TagBindings + * @instance + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsRequest} request ListEffectiveTagsRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagBindings.ListEffectiveTagsCallback} callback Node-style callback called with the error, if any, and ListEffectiveTagsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TagBindings.prototype.listEffectiveTags = function listEffectiveTags(request, callback) { + return this.rpcCall(listEffectiveTags, $root.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest, $root.google.cloud.resourcemanager.v3.ListEffectiveTagsResponse, request, callback); + }, "name", { value: "ListEffectiveTags" }); + + /** + * Calls ListEffectiveTags. + * @function listEffectiveTags + * @memberof google.cloud.resourcemanager.v3.TagBindings + * @instance + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsRequest} request ListEffectiveTagsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return TagBindings; })(); @@ -10174,6 +10207,7 @@ * @property {string|null} [name] TagBinding name * @property {string|null} [parent] TagBinding parent * @property {string|null} [tagValue] TagBinding tagValue + * @property {string|null} [tagValueNamespacedName] TagBinding tagValueNamespacedName */ /** @@ -10215,6 +10249,14 @@ */ TagBinding.prototype.tagValue = ""; + /** + * TagBinding tagValueNamespacedName. + * @member {string} tagValueNamespacedName + * @memberof google.cloud.resourcemanager.v3.TagBinding + * @instance + */ + TagBinding.prototype.tagValueNamespacedName = ""; + /** * Creates a new TagBinding instance using the specified properties. * @function create @@ -10245,6 +10287,8 @@ writer.uint32(/* id 2, wireType 2 =*/18).string(message.parent); if (message.tagValue != null && Object.hasOwnProperty.call(message, "tagValue")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.tagValue); + if (message.tagValueNamespacedName != null && Object.hasOwnProperty.call(message, "tagValueNamespacedName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.tagValueNamespacedName); return writer; }; @@ -10291,6 +10335,10 @@ message.tagValue = reader.string(); break; } + case 4: { + message.tagValueNamespacedName = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -10335,6 +10383,9 @@ if (message.tagValue != null && message.hasOwnProperty("tagValue")) if (!$util.isString(message.tagValue)) return "tagValue: string expected"; + if (message.tagValueNamespacedName != null && message.hasOwnProperty("tagValueNamespacedName")) + if (!$util.isString(message.tagValueNamespacedName)) + return "tagValueNamespacedName: string expected"; return null; }; @@ -10356,6 +10407,8 @@ message.parent = String(object.parent); if (object.tagValue != null) message.tagValue = String(object.tagValue); + if (object.tagValueNamespacedName != null) + message.tagValueNamespacedName = String(object.tagValueNamespacedName); return message; }; @@ -10376,6 +10429,7 @@ object.name = ""; object.parent = ""; object.tagValue = ""; + object.tagValueNamespacedName = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -10383,6 +10437,8 @@ object.parent = message.parent; if (message.tagValue != null && message.hasOwnProperty("tagValue")) object.tagValue = message.tagValue; + if (message.tagValueNamespacedName != null && message.hasOwnProperty("tagValueNamespacedName")) + object.tagValueNamespacedName = message.tagValueNamespacedName; return object; }; @@ -11698,153 +11754,2791 @@ return ListTagBindingsResponse; })(); - v3.TagKeys = (function() { + v3.ListEffectiveTagsRequest = (function() { /** - * Constructs a new TagKeys service. + * Properties of a ListEffectiveTagsRequest. * @memberof google.cloud.resourcemanager.v3 - * @classdesc Represents a TagKeys - * @extends $protobuf.rpc.Service + * @interface IListEffectiveTagsRequest + * @property {string|null} [parent] ListEffectiveTagsRequest parent + * @property {number|null} [pageSize] ListEffectiveTagsRequest pageSize + * @property {string|null} [pageToken] ListEffectiveTagsRequest pageToken + */ + + /** + * Constructs a new ListEffectiveTagsRequest. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a ListEffectiveTagsRequest. + * @implements IListEffectiveTagsRequest * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsRequest=} [properties] Properties to set */ - function TagKeys(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function ListEffectiveTagsRequest(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]]; } - (TagKeys.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = TagKeys; - /** - * Creates new TagKeys service using the specified rpc implementation. - * @function create - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {TagKeys} RPC service. Useful where requests and/or responses are streamed. + * ListEffectiveTagsRequest parent. + * @member {string} parent + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @instance */ - TagKeys.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + ListEffectiveTagsRequest.prototype.parent = ""; /** - * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|listTagKeys}. - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @typedef ListTagKeysCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.resourcemanager.v3.ListTagKeysResponse} [response] ListTagKeysResponse + * ListEffectiveTagsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @instance */ + ListEffectiveTagsRequest.prototype.pageSize = 0; /** - * Calls ListTagKeys. - * @function listTagKeys - * @memberof google.cloud.resourcemanager.v3.TagKeys + * ListEffectiveTagsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest * @instance - * @param {google.cloud.resourcemanager.v3.IListTagKeysRequest} request ListTagKeysRequest message or plain object - * @param {google.cloud.resourcemanager.v3.TagKeys.ListTagKeysCallback} callback Node-style callback called with the error, if any, and ListTagKeysResponse - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(TagKeys.prototype.listTagKeys = function listTagKeys(request, callback) { - return this.rpcCall(listTagKeys, $root.google.cloud.resourcemanager.v3.ListTagKeysRequest, $root.google.cloud.resourcemanager.v3.ListTagKeysResponse, request, callback); - }, "name", { value: "ListTagKeys" }); + ListEffectiveTagsRequest.prototype.pageToken = ""; /** - * Calls ListTagKeys. - * @function listTagKeys - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @instance - * @param {google.cloud.resourcemanager.v3.IListTagKeysRequest} request ListTagKeysRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Creates a new ListEffectiveTagsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @static + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsRequest=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.ListEffectiveTagsRequest} ListEffectiveTagsRequest instance */ + ListEffectiveTagsRequest.create = function create(properties) { + return new ListEffectiveTagsRequest(properties); + }; /** - * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|getTagKey}. - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @typedef GetTagKeyCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.resourcemanager.v3.TagKey} [response] TagKey + * Encodes the specified ListEffectiveTagsRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListEffectiveTagsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @static + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsRequest} message ListEffectiveTagsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + ListEffectiveTagsRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; /** - * Calls GetTagKey. - * @function getTagKey - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @instance - * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest} request GetTagKeyRequest message or plain object - * @param {google.cloud.resourcemanager.v3.TagKeys.GetTagKeyCallback} callback Node-style callback called with the error, if any, and TagKey - * @returns {undefined} - * @variation 1 + * Encodes the specified ListEffectiveTagsRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListEffectiveTagsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @static + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsRequest} message ListEffectiveTagsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(TagKeys.prototype.getTagKey = function getTagKey(request, callback) { - return this.rpcCall(getTagKey, $root.google.cloud.resourcemanager.v3.GetTagKeyRequest, $root.google.cloud.resourcemanager.v3.TagKey, request, callback); - }, "name", { value: "GetTagKey" }); + ListEffectiveTagsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls GetTagKey. - * @function getTagKey - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @instance - * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest} request GetTagKeyRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes a ListEffectiveTagsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.ListEffectiveTagsRequest} ListEffectiveTagsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + ListEffectiveTagsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|createTagKey}. - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @typedef CreateTagKeyCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Decodes a ListEffectiveTagsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.ListEffectiveTagsRequest} ListEffectiveTagsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + ListEffectiveTagsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Calls CreateTagKey. - * @function createTagKey - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @instance - * @param {google.cloud.resourcemanager.v3.ICreateTagKeyRequest} request CreateTagKeyRequest message or plain object - * @param {google.cloud.resourcemanager.v3.TagKeys.CreateTagKeyCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Verifies a ListEffectiveTagsRequest message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Object.defineProperty(TagKeys.prototype.createTagKey = function createTagKey(request, callback) { - return this.rpcCall(createTagKey, $root.google.cloud.resourcemanager.v3.CreateTagKeyRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "CreateTagKey" }); + ListEffectiveTagsRequest.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.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; /** - * Calls CreateTagKey. - * @function createTagKey - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @instance - * @param {google.cloud.resourcemanager.v3.ICreateTagKeyRequest} request CreateTagKeyRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Creates a ListEffectiveTagsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.ListEffectiveTagsRequest} ListEffectiveTagsRequest */ + ListEffectiveTagsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest) + return object; + var message = new $root.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; /** - * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|updateTagKey}. - * @memberof google.cloud.resourcemanager.v3.TagKeys - * @typedef UpdateTagKeyCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Creates a plain object from a ListEffectiveTagsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @static + * @param {google.cloud.resourcemanager.v3.ListEffectiveTagsRequest} message ListEffectiveTagsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ + ListEffectiveTagsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; /** - * Calls UpdateTagKey. - * @function updateTagKey - * @memberof google.cloud.resourcemanager.v3.TagKeys + * Converts this ListEffectiveTagsRequest to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest * @instance - * @param {google.cloud.resourcemanager.v3.IUpdateTagKeyRequest} request UpdateTagKeyRequest message or plain object - * @param {google.cloud.resourcemanager.v3.TagKeys.UpdateTagKeyCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {Object.} JSON object + */ + ListEffectiveTagsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEffectiveTagsRequest + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEffectiveTagsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.ListEffectiveTagsRequest"; + }; + + return ListEffectiveTagsRequest; + })(); + + v3.ListEffectiveTagsResponse = (function() { + + /** + * Properties of a ListEffectiveTagsResponse. + * @memberof google.cloud.resourcemanager.v3 + * @interface IListEffectiveTagsResponse + * @property {Array.|null} [effectiveTags] ListEffectiveTagsResponse effectiveTags + * @property {string|null} [nextPageToken] ListEffectiveTagsResponse nextPageToken + */ + + /** + * Constructs a new ListEffectiveTagsResponse. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a ListEffectiveTagsResponse. + * @implements IListEffectiveTagsResponse + * @constructor + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsResponse=} [properties] Properties to set + */ + function ListEffectiveTagsResponse(properties) { + this.effectiveTags = []; + 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]]; + } + + /** + * ListEffectiveTagsResponse effectiveTags. + * @member {Array.} effectiveTags + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @instance + */ + ListEffectiveTagsResponse.prototype.effectiveTags = $util.emptyArray; + + /** + * ListEffectiveTagsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @instance + */ + ListEffectiveTagsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListEffectiveTagsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @static + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsResponse=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.ListEffectiveTagsResponse} ListEffectiveTagsResponse instance + */ + ListEffectiveTagsResponse.create = function create(properties) { + return new ListEffectiveTagsResponse(properties); + }; + + /** + * Encodes the specified ListEffectiveTagsResponse message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListEffectiveTagsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @static + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsResponse} message ListEffectiveTagsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEffectiveTagsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.effectiveTags != null && message.effectiveTags.length) + for (var i = 0; i < message.effectiveTags.length; ++i) + $root.google.cloud.resourcemanager.v3.EffectiveTag.encode(message.effectiveTags[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListEffectiveTagsResponse message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListEffectiveTagsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @static + * @param {google.cloud.resourcemanager.v3.IListEffectiveTagsResponse} message ListEffectiveTagsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEffectiveTagsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEffectiveTagsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.ListEffectiveTagsResponse} ListEffectiveTagsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEffectiveTagsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.ListEffectiveTagsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.effectiveTags && message.effectiveTags.length)) + message.effectiveTags = []; + message.effectiveTags.push($root.google.cloud.resourcemanager.v3.EffectiveTag.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEffectiveTagsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.ListEffectiveTagsResponse} ListEffectiveTagsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEffectiveTagsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEffectiveTagsResponse message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEffectiveTagsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.effectiveTags != null && message.hasOwnProperty("effectiveTags")) { + if (!Array.isArray(message.effectiveTags)) + return "effectiveTags: array expected"; + for (var i = 0; i < message.effectiveTags.length; ++i) { + var error = $root.google.cloud.resourcemanager.v3.EffectiveTag.verify(message.effectiveTags[i]); + if (error) + return "effectiveTags." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListEffectiveTagsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.ListEffectiveTagsResponse} ListEffectiveTagsResponse + */ + ListEffectiveTagsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.ListEffectiveTagsResponse) + return object; + var message = new $root.google.cloud.resourcemanager.v3.ListEffectiveTagsResponse(); + if (object.effectiveTags) { + if (!Array.isArray(object.effectiveTags)) + throw TypeError(".google.cloud.resourcemanager.v3.ListEffectiveTagsResponse.effectiveTags: array expected"); + message.effectiveTags = []; + for (var i = 0; i < object.effectiveTags.length; ++i) { + if (typeof object.effectiveTags[i] !== "object") + throw TypeError(".google.cloud.resourcemanager.v3.ListEffectiveTagsResponse.effectiveTags: object expected"); + message.effectiveTags[i] = $root.google.cloud.resourcemanager.v3.EffectiveTag.fromObject(object.effectiveTags[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListEffectiveTagsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @static + * @param {google.cloud.resourcemanager.v3.ListEffectiveTagsResponse} message ListEffectiveTagsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEffectiveTagsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.effectiveTags = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.effectiveTags && message.effectiveTags.length) { + object.effectiveTags = []; + for (var j = 0; j < message.effectiveTags.length; ++j) + object.effectiveTags[j] = $root.google.cloud.resourcemanager.v3.EffectiveTag.toObject(message.effectiveTags[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListEffectiveTagsResponse to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @instance + * @returns {Object.} JSON object + */ + ListEffectiveTagsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEffectiveTagsResponse + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.ListEffectiveTagsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEffectiveTagsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.ListEffectiveTagsResponse"; + }; + + return ListEffectiveTagsResponse; + })(); + + v3.EffectiveTag = (function() { + + /** + * Properties of an EffectiveTag. + * @memberof google.cloud.resourcemanager.v3 + * @interface IEffectiveTag + * @property {string|null} [tagValue] EffectiveTag tagValue + * @property {string|null} [namespacedTagValue] EffectiveTag namespacedTagValue + * @property {string|null} [tagKey] EffectiveTag tagKey + * @property {string|null} [namespacedTagKey] EffectiveTag namespacedTagKey + * @property {string|null} [tagKeyParentName] EffectiveTag tagKeyParentName + * @property {boolean|null} [inherited] EffectiveTag inherited + */ + + /** + * Constructs a new EffectiveTag. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents an EffectiveTag. + * @implements IEffectiveTag + * @constructor + * @param {google.cloud.resourcemanager.v3.IEffectiveTag=} [properties] Properties to set + */ + function EffectiveTag(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]]; + } + + /** + * EffectiveTag tagValue. + * @member {string} tagValue + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @instance + */ + EffectiveTag.prototype.tagValue = ""; + + /** + * EffectiveTag namespacedTagValue. + * @member {string} namespacedTagValue + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @instance + */ + EffectiveTag.prototype.namespacedTagValue = ""; + + /** + * EffectiveTag tagKey. + * @member {string} tagKey + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @instance + */ + EffectiveTag.prototype.tagKey = ""; + + /** + * EffectiveTag namespacedTagKey. + * @member {string} namespacedTagKey + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @instance + */ + EffectiveTag.prototype.namespacedTagKey = ""; + + /** + * EffectiveTag tagKeyParentName. + * @member {string} tagKeyParentName + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @instance + */ + EffectiveTag.prototype.tagKeyParentName = ""; + + /** + * EffectiveTag inherited. + * @member {boolean} inherited + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @instance + */ + EffectiveTag.prototype.inherited = false; + + /** + * Creates a new EffectiveTag instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @static + * @param {google.cloud.resourcemanager.v3.IEffectiveTag=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.EffectiveTag} EffectiveTag instance + */ + EffectiveTag.create = function create(properties) { + return new EffectiveTag(properties); + }; + + /** + * Encodes the specified EffectiveTag message. Does not implicitly {@link google.cloud.resourcemanager.v3.EffectiveTag.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @static + * @param {google.cloud.resourcemanager.v3.IEffectiveTag} message EffectiveTag message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EffectiveTag.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tagValue != null && Object.hasOwnProperty.call(message, "tagValue")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.tagValue); + if (message.namespacedTagValue != null && Object.hasOwnProperty.call(message, "namespacedTagValue")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.namespacedTagValue); + if (message.tagKey != null && Object.hasOwnProperty.call(message, "tagKey")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.tagKey); + if (message.namespacedTagKey != null && Object.hasOwnProperty.call(message, "namespacedTagKey")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.namespacedTagKey); + if (message.inherited != null && Object.hasOwnProperty.call(message, "inherited")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.inherited); + if (message.tagKeyParentName != null && Object.hasOwnProperty.call(message, "tagKeyParentName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.tagKeyParentName); + return writer; + }; + + /** + * Encodes the specified EffectiveTag message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.EffectiveTag.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @static + * @param {google.cloud.resourcemanager.v3.IEffectiveTag} message EffectiveTag message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EffectiveTag.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EffectiveTag message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.EffectiveTag} EffectiveTag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EffectiveTag.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.EffectiveTag(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.tagValue = reader.string(); + break; + } + case 2: { + message.namespacedTagValue = reader.string(); + break; + } + case 3: { + message.tagKey = reader.string(); + break; + } + case 4: { + message.namespacedTagKey = reader.string(); + break; + } + case 6: { + message.tagKeyParentName = reader.string(); + break; + } + case 5: { + message.inherited = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EffectiveTag message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.EffectiveTag} EffectiveTag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EffectiveTag.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EffectiveTag message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EffectiveTag.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tagValue != null && message.hasOwnProperty("tagValue")) + if (!$util.isString(message.tagValue)) + return "tagValue: string expected"; + if (message.namespacedTagValue != null && message.hasOwnProperty("namespacedTagValue")) + if (!$util.isString(message.namespacedTagValue)) + return "namespacedTagValue: string expected"; + if (message.tagKey != null && message.hasOwnProperty("tagKey")) + if (!$util.isString(message.tagKey)) + return "tagKey: string expected"; + if (message.namespacedTagKey != null && message.hasOwnProperty("namespacedTagKey")) + if (!$util.isString(message.namespacedTagKey)) + return "namespacedTagKey: string expected"; + if (message.tagKeyParentName != null && message.hasOwnProperty("tagKeyParentName")) + if (!$util.isString(message.tagKeyParentName)) + return "tagKeyParentName: string expected"; + if (message.inherited != null && message.hasOwnProperty("inherited")) + if (typeof message.inherited !== "boolean") + return "inherited: boolean expected"; + return null; + }; + + /** + * Creates an EffectiveTag message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.EffectiveTag} EffectiveTag + */ + EffectiveTag.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.EffectiveTag) + return object; + var message = new $root.google.cloud.resourcemanager.v3.EffectiveTag(); + if (object.tagValue != null) + message.tagValue = String(object.tagValue); + if (object.namespacedTagValue != null) + message.namespacedTagValue = String(object.namespacedTagValue); + if (object.tagKey != null) + message.tagKey = String(object.tagKey); + if (object.namespacedTagKey != null) + message.namespacedTagKey = String(object.namespacedTagKey); + if (object.tagKeyParentName != null) + message.tagKeyParentName = String(object.tagKeyParentName); + if (object.inherited != null) + message.inherited = Boolean(object.inherited); + return message; + }; + + /** + * Creates a plain object from an EffectiveTag message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @static + * @param {google.cloud.resourcemanager.v3.EffectiveTag} message EffectiveTag + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EffectiveTag.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.tagValue = ""; + object.namespacedTagValue = ""; + object.tagKey = ""; + object.namespacedTagKey = ""; + object.inherited = false; + object.tagKeyParentName = ""; + } + if (message.tagValue != null && message.hasOwnProperty("tagValue")) + object.tagValue = message.tagValue; + if (message.namespacedTagValue != null && message.hasOwnProperty("namespacedTagValue")) + object.namespacedTagValue = message.namespacedTagValue; + if (message.tagKey != null && message.hasOwnProperty("tagKey")) + object.tagKey = message.tagKey; + if (message.namespacedTagKey != null && message.hasOwnProperty("namespacedTagKey")) + object.namespacedTagKey = message.namespacedTagKey; + if (message.inherited != null && message.hasOwnProperty("inherited")) + object.inherited = message.inherited; + if (message.tagKeyParentName != null && message.hasOwnProperty("tagKeyParentName")) + object.tagKeyParentName = message.tagKeyParentName; + return object; + }; + + /** + * Converts this EffectiveTag to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @instance + * @returns {Object.} JSON object + */ + EffectiveTag.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EffectiveTag + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.EffectiveTag + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EffectiveTag.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.EffectiveTag"; + }; + + return EffectiveTag; + })(); + + v3.TagHolds = (function() { + + /** + * Constructs a new TagHolds service. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a TagHolds + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function TagHolds(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (TagHolds.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = TagHolds; + + /** + * Creates new TagHolds service using the specified rpc implementation. + * @function create + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {TagHolds} RPC service. Useful where requests and/or responses are streamed. + */ + TagHolds.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagHolds|createTagHold}. + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @typedef CreateTagHoldCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateTagHold. + * @function createTagHold + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @instance + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldRequest} request CreateTagHoldRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagHolds.CreateTagHoldCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TagHolds.prototype.createTagHold = function createTagHold(request, callback) { + return this.rpcCall(createTagHold, $root.google.cloud.resourcemanager.v3.CreateTagHoldRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateTagHold" }); + + /** + * Calls CreateTagHold. + * @function createTagHold + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @instance + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldRequest} request CreateTagHoldRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagHolds|deleteTagHold}. + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @typedef DeleteTagHoldCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteTagHold. + * @function deleteTagHold + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @instance + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldRequest} request DeleteTagHoldRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagHolds.DeleteTagHoldCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TagHolds.prototype.deleteTagHold = function deleteTagHold(request, callback) { + return this.rpcCall(deleteTagHold, $root.google.cloud.resourcemanager.v3.DeleteTagHoldRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteTagHold" }); + + /** + * Calls DeleteTagHold. + * @function deleteTagHold + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @instance + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldRequest} request DeleteTagHoldRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagHolds|listTagHolds}. + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @typedef ListTagHoldsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.resourcemanager.v3.ListTagHoldsResponse} [response] ListTagHoldsResponse + */ + + /** + * Calls ListTagHolds. + * @function listTagHolds + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @instance + * @param {google.cloud.resourcemanager.v3.IListTagHoldsRequest} request ListTagHoldsRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagHolds.ListTagHoldsCallback} callback Node-style callback called with the error, if any, and ListTagHoldsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TagHolds.prototype.listTagHolds = function listTagHolds(request, callback) { + return this.rpcCall(listTagHolds, $root.google.cloud.resourcemanager.v3.ListTagHoldsRequest, $root.google.cloud.resourcemanager.v3.ListTagHoldsResponse, request, callback); + }, "name", { value: "ListTagHolds" }); + + /** + * Calls ListTagHolds. + * @function listTagHolds + * @memberof google.cloud.resourcemanager.v3.TagHolds + * @instance + * @param {google.cloud.resourcemanager.v3.IListTagHoldsRequest} request ListTagHoldsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return TagHolds; + })(); + + v3.TagHold = (function() { + + /** + * Properties of a TagHold. + * @memberof google.cloud.resourcemanager.v3 + * @interface ITagHold + * @property {string|null} [name] TagHold name + * @property {string|null} [holder] TagHold holder + * @property {string|null} [origin] TagHold origin + * @property {string|null} [helpLink] TagHold helpLink + * @property {google.protobuf.ITimestamp|null} [createTime] TagHold createTime + */ + + /** + * Constructs a new TagHold. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a TagHold. + * @implements ITagHold + * @constructor + * @param {google.cloud.resourcemanager.v3.ITagHold=} [properties] Properties to set + */ + function TagHold(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]]; + } + + /** + * TagHold name. + * @member {string} name + * @memberof google.cloud.resourcemanager.v3.TagHold + * @instance + */ + TagHold.prototype.name = ""; + + /** + * TagHold holder. + * @member {string} holder + * @memberof google.cloud.resourcemanager.v3.TagHold + * @instance + */ + TagHold.prototype.holder = ""; + + /** + * TagHold origin. + * @member {string} origin + * @memberof google.cloud.resourcemanager.v3.TagHold + * @instance + */ + TagHold.prototype.origin = ""; + + /** + * TagHold helpLink. + * @member {string} helpLink + * @memberof google.cloud.resourcemanager.v3.TagHold + * @instance + */ + TagHold.prototype.helpLink = ""; + + /** + * TagHold createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.resourcemanager.v3.TagHold + * @instance + */ + TagHold.prototype.createTime = null; + + /** + * Creates a new TagHold instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.TagHold + * @static + * @param {google.cloud.resourcemanager.v3.ITagHold=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.TagHold} TagHold instance + */ + TagHold.create = function create(properties) { + return new TagHold(properties); + }; + + /** + * Encodes the specified TagHold message. Does not implicitly {@link google.cloud.resourcemanager.v3.TagHold.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.TagHold + * @static + * @param {google.cloud.resourcemanager.v3.ITagHold} message TagHold message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TagHold.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.holder != null && Object.hasOwnProperty.call(message, "holder")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.holder); + if (message.origin != null && Object.hasOwnProperty.call(message, "origin")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.origin); + if (message.helpLink != null && Object.hasOwnProperty.call(message, "helpLink")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.helpLink); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TagHold message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.TagHold.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.TagHold + * @static + * @param {google.cloud.resourcemanager.v3.ITagHold} message TagHold message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TagHold.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TagHold message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.TagHold + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.TagHold} TagHold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TagHold.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.TagHold(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.holder = reader.string(); + break; + } + case 3: { + message.origin = reader.string(); + break; + } + case 4: { + message.helpLink = reader.string(); + break; + } + case 5: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TagHold message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.TagHold + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.TagHold} TagHold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TagHold.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TagHold message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.TagHold + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TagHold.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.holder != null && message.hasOwnProperty("holder")) + if (!$util.isString(message.holder)) + return "holder: string expected"; + if (message.origin != null && message.hasOwnProperty("origin")) + if (!$util.isString(message.origin)) + return "origin: string expected"; + if (message.helpLink != null && message.hasOwnProperty("helpLink")) + if (!$util.isString(message.helpLink)) + return "helpLink: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a TagHold message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.TagHold + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.TagHold} TagHold + */ + TagHold.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.TagHold) + return object; + var message = new $root.google.cloud.resourcemanager.v3.TagHold(); + if (object.name != null) + message.name = String(object.name); + if (object.holder != null) + message.holder = String(object.holder); + if (object.origin != null) + message.origin = String(object.origin); + if (object.helpLink != null) + message.helpLink = String(object.helpLink); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.resourcemanager.v3.TagHold.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a TagHold message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.TagHold + * @static + * @param {google.cloud.resourcemanager.v3.TagHold} message TagHold + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TagHold.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.holder = ""; + object.origin = ""; + object.helpLink = ""; + object.createTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.holder != null && message.hasOwnProperty("holder")) + object.holder = message.holder; + if (message.origin != null && message.hasOwnProperty("origin")) + object.origin = message.origin; + if (message.helpLink != null && message.hasOwnProperty("helpLink")) + object.helpLink = message.helpLink; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this TagHold to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.TagHold + * @instance + * @returns {Object.} JSON object + */ + TagHold.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TagHold + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.TagHold + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TagHold.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.TagHold"; + }; + + return TagHold; + })(); + + v3.CreateTagHoldRequest = (function() { + + /** + * Properties of a CreateTagHoldRequest. + * @memberof google.cloud.resourcemanager.v3 + * @interface ICreateTagHoldRequest + * @property {string|null} [parent] CreateTagHoldRequest parent + * @property {google.cloud.resourcemanager.v3.ITagHold|null} [tagHold] CreateTagHoldRequest tagHold + * @property {boolean|null} [validateOnly] CreateTagHoldRequest validateOnly + */ + + /** + * Constructs a new CreateTagHoldRequest. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a CreateTagHoldRequest. + * @implements ICreateTagHoldRequest + * @constructor + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldRequest=} [properties] Properties to set + */ + function CreateTagHoldRequest(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]]; + } + + /** + * CreateTagHoldRequest parent. + * @member {string} parent + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @instance + */ + CreateTagHoldRequest.prototype.parent = ""; + + /** + * CreateTagHoldRequest tagHold. + * @member {google.cloud.resourcemanager.v3.ITagHold|null|undefined} tagHold + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @instance + */ + CreateTagHoldRequest.prototype.tagHold = null; + + /** + * CreateTagHoldRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @instance + */ + CreateTagHoldRequest.prototype.validateOnly = false; + + /** + * Creates a new CreateTagHoldRequest instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @static + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldRequest=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.CreateTagHoldRequest} CreateTagHoldRequest instance + */ + CreateTagHoldRequest.create = function create(properties) { + return new CreateTagHoldRequest(properties); + }; + + /** + * Encodes the specified CreateTagHoldRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.CreateTagHoldRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @static + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldRequest} message CreateTagHoldRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTagHoldRequest.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.tagHold != null && Object.hasOwnProperty.call(message, "tagHold")) + $root.google.cloud.resourcemanager.v3.TagHold.encode(message.tagHold, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified CreateTagHoldRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.CreateTagHoldRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @static + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldRequest} message CreateTagHoldRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTagHoldRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateTagHoldRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.CreateTagHoldRequest} CreateTagHoldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTagHoldRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.CreateTagHoldRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.tagHold = $root.google.cloud.resourcemanager.v3.TagHold.decode(reader, reader.uint32()); + break; + } + case 3: { + message.validateOnly = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateTagHoldRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.CreateTagHoldRequest} CreateTagHoldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTagHoldRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateTagHoldRequest message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateTagHoldRequest.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.tagHold != null && message.hasOwnProperty("tagHold")) { + var error = $root.google.cloud.resourcemanager.v3.TagHold.verify(message.tagHold); + if (error) + return "tagHold." + error; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a CreateTagHoldRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.CreateTagHoldRequest} CreateTagHoldRequest + */ + CreateTagHoldRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.CreateTagHoldRequest) + return object; + var message = new $root.google.cloud.resourcemanager.v3.CreateTagHoldRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.tagHold != null) { + if (typeof object.tagHold !== "object") + throw TypeError(".google.cloud.resourcemanager.v3.CreateTagHoldRequest.tagHold: object expected"); + message.tagHold = $root.google.cloud.resourcemanager.v3.TagHold.fromObject(object.tagHold); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a CreateTagHoldRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @static + * @param {google.cloud.resourcemanager.v3.CreateTagHoldRequest} message CreateTagHoldRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateTagHoldRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.tagHold = null; + object.validateOnly = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.tagHold != null && message.hasOwnProperty("tagHold")) + object.tagHold = $root.google.cloud.resourcemanager.v3.TagHold.toObject(message.tagHold, options); + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this CreateTagHoldRequest to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @instance + * @returns {Object.} JSON object + */ + CreateTagHoldRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateTagHoldRequest + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateTagHoldRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.CreateTagHoldRequest"; + }; + + return CreateTagHoldRequest; + })(); + + v3.CreateTagHoldMetadata = (function() { + + /** + * Properties of a CreateTagHoldMetadata. + * @memberof google.cloud.resourcemanager.v3 + * @interface ICreateTagHoldMetadata + */ + + /** + * Constructs a new CreateTagHoldMetadata. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a CreateTagHoldMetadata. + * @implements ICreateTagHoldMetadata + * @constructor + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldMetadata=} [properties] Properties to set + */ + function CreateTagHoldMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new CreateTagHoldMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @static + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldMetadata=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.CreateTagHoldMetadata} CreateTagHoldMetadata instance + */ + CreateTagHoldMetadata.create = function create(properties) { + return new CreateTagHoldMetadata(properties); + }; + + /** + * Encodes the specified CreateTagHoldMetadata message. Does not implicitly {@link google.cloud.resourcemanager.v3.CreateTagHoldMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @static + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldMetadata} message CreateTagHoldMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTagHoldMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified CreateTagHoldMetadata message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.CreateTagHoldMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @static + * @param {google.cloud.resourcemanager.v3.ICreateTagHoldMetadata} message CreateTagHoldMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTagHoldMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateTagHoldMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.CreateTagHoldMetadata} CreateTagHoldMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTagHoldMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.CreateTagHoldMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateTagHoldMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.CreateTagHoldMetadata} CreateTagHoldMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTagHoldMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateTagHoldMetadata message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateTagHoldMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a CreateTagHoldMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.CreateTagHoldMetadata} CreateTagHoldMetadata + */ + CreateTagHoldMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.CreateTagHoldMetadata) + return object; + return new $root.google.cloud.resourcemanager.v3.CreateTagHoldMetadata(); + }; + + /** + * Creates a plain object from a CreateTagHoldMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @static + * @param {google.cloud.resourcemanager.v3.CreateTagHoldMetadata} message CreateTagHoldMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateTagHoldMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this CreateTagHoldMetadata to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateTagHoldMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateTagHoldMetadata + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.CreateTagHoldMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateTagHoldMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.CreateTagHoldMetadata"; + }; + + return CreateTagHoldMetadata; + })(); + + v3.DeleteTagHoldRequest = (function() { + + /** + * Properties of a DeleteTagHoldRequest. + * @memberof google.cloud.resourcemanager.v3 + * @interface IDeleteTagHoldRequest + * @property {string|null} [name] DeleteTagHoldRequest name + * @property {boolean|null} [validateOnly] DeleteTagHoldRequest validateOnly + */ + + /** + * Constructs a new DeleteTagHoldRequest. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a DeleteTagHoldRequest. + * @implements IDeleteTagHoldRequest + * @constructor + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldRequest=} [properties] Properties to set + */ + function DeleteTagHoldRequest(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]]; + } + + /** + * DeleteTagHoldRequest name. + * @member {string} name + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @instance + */ + DeleteTagHoldRequest.prototype.name = ""; + + /** + * DeleteTagHoldRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @instance + */ + DeleteTagHoldRequest.prototype.validateOnly = false; + + /** + * Creates a new DeleteTagHoldRequest instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @static + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldRequest=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.DeleteTagHoldRequest} DeleteTagHoldRequest instance + */ + DeleteTagHoldRequest.create = function create(properties) { + return new DeleteTagHoldRequest(properties); + }; + + /** + * Encodes the specified DeleteTagHoldRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagHoldRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @static + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldRequest} message DeleteTagHoldRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTagHoldRequest.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.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified DeleteTagHoldRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagHoldRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @static + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldRequest} message DeleteTagHoldRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTagHoldRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteTagHoldRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.DeleteTagHoldRequest} DeleteTagHoldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTagHoldRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.DeleteTagHoldRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.validateOnly = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteTagHoldRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.DeleteTagHoldRequest} DeleteTagHoldRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTagHoldRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteTagHoldRequest message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteTagHoldRequest.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.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a DeleteTagHoldRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.DeleteTagHoldRequest} DeleteTagHoldRequest + */ + DeleteTagHoldRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.DeleteTagHoldRequest) + return object; + var message = new $root.google.cloud.resourcemanager.v3.DeleteTagHoldRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a DeleteTagHoldRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @static + * @param {google.cloud.resourcemanager.v3.DeleteTagHoldRequest} message DeleteTagHoldRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteTagHoldRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.validateOnly = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this DeleteTagHoldRequest to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteTagHoldRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteTagHoldRequest + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteTagHoldRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.DeleteTagHoldRequest"; + }; + + return DeleteTagHoldRequest; + })(); + + v3.DeleteTagHoldMetadata = (function() { + + /** + * Properties of a DeleteTagHoldMetadata. + * @memberof google.cloud.resourcemanager.v3 + * @interface IDeleteTagHoldMetadata + */ + + /** + * Constructs a new DeleteTagHoldMetadata. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a DeleteTagHoldMetadata. + * @implements IDeleteTagHoldMetadata + * @constructor + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata=} [properties] Properties to set + */ + function DeleteTagHoldMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new DeleteTagHoldMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @static + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.DeleteTagHoldMetadata} DeleteTagHoldMetadata instance + */ + DeleteTagHoldMetadata.create = function create(properties) { + return new DeleteTagHoldMetadata(properties); + }; + + /** + * Encodes the specified DeleteTagHoldMetadata message. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagHoldMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @static + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata} message DeleteTagHoldMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTagHoldMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DeleteTagHoldMetadata message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.DeleteTagHoldMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @static + * @param {google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata} message DeleteTagHoldMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTagHoldMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteTagHoldMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.DeleteTagHoldMetadata} DeleteTagHoldMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTagHoldMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.DeleteTagHoldMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteTagHoldMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.DeleteTagHoldMetadata} DeleteTagHoldMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTagHoldMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteTagHoldMetadata message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteTagHoldMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DeleteTagHoldMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.DeleteTagHoldMetadata} DeleteTagHoldMetadata + */ + DeleteTagHoldMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.DeleteTagHoldMetadata) + return object; + return new $root.google.cloud.resourcemanager.v3.DeleteTagHoldMetadata(); + }; + + /** + * Creates a plain object from a DeleteTagHoldMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @static + * @param {google.cloud.resourcemanager.v3.DeleteTagHoldMetadata} message DeleteTagHoldMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteTagHoldMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DeleteTagHoldMetadata to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteTagHoldMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteTagHoldMetadata + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteTagHoldMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.DeleteTagHoldMetadata"; + }; + + return DeleteTagHoldMetadata; + })(); + + v3.ListTagHoldsRequest = (function() { + + /** + * Properties of a ListTagHoldsRequest. + * @memberof google.cloud.resourcemanager.v3 + * @interface IListTagHoldsRequest + * @property {string|null} [parent] ListTagHoldsRequest parent + * @property {number|null} [pageSize] ListTagHoldsRequest pageSize + * @property {string|null} [pageToken] ListTagHoldsRequest pageToken + * @property {string|null} [filter] ListTagHoldsRequest filter + */ + + /** + * Constructs a new ListTagHoldsRequest. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a ListTagHoldsRequest. + * @implements IListTagHoldsRequest + * @constructor + * @param {google.cloud.resourcemanager.v3.IListTagHoldsRequest=} [properties] Properties to set + */ + function ListTagHoldsRequest(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]]; + } + + /** + * ListTagHoldsRequest parent. + * @member {string} parent + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @instance + */ + ListTagHoldsRequest.prototype.parent = ""; + + /** + * ListTagHoldsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @instance + */ + ListTagHoldsRequest.prototype.pageSize = 0; + + /** + * ListTagHoldsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @instance + */ + ListTagHoldsRequest.prototype.pageToken = ""; + + /** + * ListTagHoldsRequest filter. + * @member {string} filter + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @instance + */ + ListTagHoldsRequest.prototype.filter = ""; + + /** + * Creates a new ListTagHoldsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @static + * @param {google.cloud.resourcemanager.v3.IListTagHoldsRequest=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.ListTagHoldsRequest} ListTagHoldsRequest instance + */ + ListTagHoldsRequest.create = function create(properties) { + return new ListTagHoldsRequest(properties); + }; + + /** + * Encodes the specified ListTagHoldsRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagHoldsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @static + * @param {google.cloud.resourcemanager.v3.IListTagHoldsRequest} message ListTagHoldsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTagHoldsRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListTagHoldsRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagHoldsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @static + * @param {google.cloud.resourcemanager.v3.IListTagHoldsRequest} message ListTagHoldsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTagHoldsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListTagHoldsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.ListTagHoldsRequest} ListTagHoldsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTagHoldsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.ListTagHoldsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListTagHoldsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.ListTagHoldsRequest} ListTagHoldsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTagHoldsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListTagHoldsRequest message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListTagHoldsRequest.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.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListTagHoldsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.ListTagHoldsRequest} ListTagHoldsRequest + */ + ListTagHoldsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.ListTagHoldsRequest) + return object; + var message = new $root.google.cloud.resourcemanager.v3.ListTagHoldsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListTagHoldsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @static + * @param {google.cloud.resourcemanager.v3.ListTagHoldsRequest} message ListTagHoldsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListTagHoldsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListTagHoldsRequest to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @instance + * @returns {Object.} JSON object + */ + ListTagHoldsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListTagHoldsRequest + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListTagHoldsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.ListTagHoldsRequest"; + }; + + return ListTagHoldsRequest; + })(); + + v3.ListTagHoldsResponse = (function() { + + /** + * Properties of a ListTagHoldsResponse. + * @memberof google.cloud.resourcemanager.v3 + * @interface IListTagHoldsResponse + * @property {Array.|null} [tagHolds] ListTagHoldsResponse tagHolds + * @property {string|null} [nextPageToken] ListTagHoldsResponse nextPageToken + */ + + /** + * Constructs a new ListTagHoldsResponse. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a ListTagHoldsResponse. + * @implements IListTagHoldsResponse + * @constructor + * @param {google.cloud.resourcemanager.v3.IListTagHoldsResponse=} [properties] Properties to set + */ + function ListTagHoldsResponse(properties) { + this.tagHolds = []; + 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]]; + } + + /** + * ListTagHoldsResponse tagHolds. + * @member {Array.} tagHolds + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @instance + */ + ListTagHoldsResponse.prototype.tagHolds = $util.emptyArray; + + /** + * ListTagHoldsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @instance + */ + ListTagHoldsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListTagHoldsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @static + * @param {google.cloud.resourcemanager.v3.IListTagHoldsResponse=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.ListTagHoldsResponse} ListTagHoldsResponse instance + */ + ListTagHoldsResponse.create = function create(properties) { + return new ListTagHoldsResponse(properties); + }; + + /** + * Encodes the specified ListTagHoldsResponse message. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagHoldsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @static + * @param {google.cloud.resourcemanager.v3.IListTagHoldsResponse} message ListTagHoldsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTagHoldsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tagHolds != null && message.tagHolds.length) + for (var i = 0; i < message.tagHolds.length; ++i) + $root.google.cloud.resourcemanager.v3.TagHold.encode(message.tagHolds[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListTagHoldsResponse message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.ListTagHoldsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @static + * @param {google.cloud.resourcemanager.v3.IListTagHoldsResponse} message ListTagHoldsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTagHoldsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListTagHoldsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.ListTagHoldsResponse} ListTagHoldsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTagHoldsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.ListTagHoldsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.tagHolds && message.tagHolds.length)) + message.tagHolds = []; + message.tagHolds.push($root.google.cloud.resourcemanager.v3.TagHold.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListTagHoldsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.ListTagHoldsResponse} ListTagHoldsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTagHoldsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListTagHoldsResponse message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListTagHoldsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tagHolds != null && message.hasOwnProperty("tagHolds")) { + if (!Array.isArray(message.tagHolds)) + return "tagHolds: array expected"; + for (var i = 0; i < message.tagHolds.length; ++i) { + var error = $root.google.cloud.resourcemanager.v3.TagHold.verify(message.tagHolds[i]); + if (error) + return "tagHolds." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListTagHoldsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.ListTagHoldsResponse} ListTagHoldsResponse + */ + ListTagHoldsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.ListTagHoldsResponse) + return object; + var message = new $root.google.cloud.resourcemanager.v3.ListTagHoldsResponse(); + if (object.tagHolds) { + if (!Array.isArray(object.tagHolds)) + throw TypeError(".google.cloud.resourcemanager.v3.ListTagHoldsResponse.tagHolds: array expected"); + message.tagHolds = []; + for (var i = 0; i < object.tagHolds.length; ++i) { + if (typeof object.tagHolds[i] !== "object") + throw TypeError(".google.cloud.resourcemanager.v3.ListTagHoldsResponse.tagHolds: object expected"); + message.tagHolds[i] = $root.google.cloud.resourcemanager.v3.TagHold.fromObject(object.tagHolds[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListTagHoldsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @static + * @param {google.cloud.resourcemanager.v3.ListTagHoldsResponse} message ListTagHoldsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListTagHoldsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.tagHolds = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.tagHolds && message.tagHolds.length) { + object.tagHolds = []; + for (var j = 0; j < message.tagHolds.length; ++j) + object.tagHolds[j] = $root.google.cloud.resourcemanager.v3.TagHold.toObject(message.tagHolds[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListTagHoldsResponse to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @instance + * @returns {Object.} JSON object + */ + ListTagHoldsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListTagHoldsResponse + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.ListTagHoldsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListTagHoldsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.ListTagHoldsResponse"; + }; + + return ListTagHoldsResponse; + })(); + + v3.TagKeys = (function() { + + /** + * Constructs a new TagKeys service. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a TagKeys + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function TagKeys(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (TagKeys.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = TagKeys; + + /** + * Creates new TagKeys service using the specified rpc implementation. + * @function create + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {TagKeys} RPC service. Useful where requests and/or responses are streamed. + */ + TagKeys.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|listTagKeys}. + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @typedef ListTagKeysCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.resourcemanager.v3.ListTagKeysResponse} [response] ListTagKeysResponse + */ + + /** + * Calls ListTagKeys. + * @function listTagKeys + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @instance + * @param {google.cloud.resourcemanager.v3.IListTagKeysRequest} request ListTagKeysRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagKeys.ListTagKeysCallback} callback Node-style callback called with the error, if any, and ListTagKeysResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TagKeys.prototype.listTagKeys = function listTagKeys(request, callback) { + return this.rpcCall(listTagKeys, $root.google.cloud.resourcemanager.v3.ListTagKeysRequest, $root.google.cloud.resourcemanager.v3.ListTagKeysResponse, request, callback); + }, "name", { value: "ListTagKeys" }); + + /** + * Calls ListTagKeys. + * @function listTagKeys + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @instance + * @param {google.cloud.resourcemanager.v3.IListTagKeysRequest} request ListTagKeysRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|getTagKey}. + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @typedef GetTagKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.resourcemanager.v3.TagKey} [response] TagKey + */ + + /** + * Calls GetTagKey. + * @function getTagKey + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @instance + * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest} request GetTagKeyRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagKeys.GetTagKeyCallback} callback Node-style callback called with the error, if any, and TagKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TagKeys.prototype.getTagKey = function getTagKey(request, callback) { + return this.rpcCall(getTagKey, $root.google.cloud.resourcemanager.v3.GetTagKeyRequest, $root.google.cloud.resourcemanager.v3.TagKey, request, callback); + }, "name", { value: "GetTagKey" }); + + /** + * Calls GetTagKey. + * @function getTagKey + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @instance + * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest} request GetTagKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|getNamespacedTagKey}. + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @typedef GetNamespacedTagKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.resourcemanager.v3.TagKey} [response] TagKey + */ + + /** + * Calls GetNamespacedTagKey. + * @function getNamespacedTagKey + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @instance + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest} request GetNamespacedTagKeyRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagKeys.GetNamespacedTagKeyCallback} callback Node-style callback called with the error, if any, and TagKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TagKeys.prototype.getNamespacedTagKey = function getNamespacedTagKey(request, callback) { + return this.rpcCall(getNamespacedTagKey, $root.google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest, $root.google.cloud.resourcemanager.v3.TagKey, request, callback); + }, "name", { value: "GetNamespacedTagKey" }); + + /** + * Calls GetNamespacedTagKey. + * @function getNamespacedTagKey + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @instance + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest} request GetNamespacedTagKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|createTagKey}. + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @typedef CreateTagKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateTagKey. + * @function createTagKey + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @instance + * @param {google.cloud.resourcemanager.v3.ICreateTagKeyRequest} request CreateTagKeyRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagKeys.CreateTagKeyCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TagKeys.prototype.createTagKey = function createTagKey(request, callback) { + return this.rpcCall(createTagKey, $root.google.cloud.resourcemanager.v3.CreateTagKeyRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateTagKey" }); + + /** + * Calls CreateTagKey. + * @function createTagKey + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @instance + * @param {google.cloud.resourcemanager.v3.ICreateTagKeyRequest} request CreateTagKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagKeys|updateTagKey}. + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @typedef UpdateTagKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateTagKey. + * @function updateTagKey + * @memberof google.cloud.resourcemanager.v3.TagKeys + * @instance + * @param {google.cloud.resourcemanager.v3.IUpdateTagKeyRequest} request UpdateTagKeyRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagKeys.UpdateTagKeyCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ @@ -12011,6 +14705,8 @@ * @property {google.protobuf.ITimestamp|null} [createTime] TagKey createTime * @property {google.protobuf.ITimestamp|null} [updateTime] TagKey updateTime * @property {string|null} [etag] TagKey etag + * @property {google.cloud.resourcemanager.v3.Purpose|null} [purpose] TagKey purpose + * @property {Object.|null} [purposeData] TagKey purposeData */ /** @@ -12022,6 +14718,7 @@ * @param {google.cloud.resourcemanager.v3.ITagKey=} [properties] Properties to set */ function TagKey(properties) { + this.purposeData = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12092,6 +14789,22 @@ */ TagKey.prototype.etag = ""; + /** + * TagKey purpose. + * @member {google.cloud.resourcemanager.v3.Purpose} purpose + * @memberof google.cloud.resourcemanager.v3.TagKey + * @instance + */ + TagKey.prototype.purpose = 0; + + /** + * TagKey purposeData. + * @member {Object.} purposeData + * @memberof google.cloud.resourcemanager.v3.TagKey + * @instance + */ + TagKey.prototype.purposeData = $util.emptyObject; + /** * Creates a new TagKey instance using the specified properties. * @function create @@ -12132,6 +14845,11 @@ $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) writer.uint32(/* id 8, wireType 2 =*/66).string(message.etag); + if (message.purpose != null && Object.hasOwnProperty.call(message, "purpose")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.purpose); + if (message.purposeData != null && Object.hasOwnProperty.call(message, "purposeData")) + for (var keys = Object.keys(message.purposeData), i = 0; i < keys.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.purposeData[keys[i]]).ldelim(); return writer; }; @@ -12162,7 +14880,7 @@ TagKey.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.TagKey(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.TagKey(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -12198,6 +14916,33 @@ message.etag = reader.string(); break; } + case 11: { + message.purpose = reader.int32(); + break; + } + case 12: { + if (message.purposeData === $util.emptyObject) + message.purposeData = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.purposeData[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -12261,6 +15006,22 @@ if (message.etag != null && message.hasOwnProperty("etag")) if (!$util.isString(message.etag)) return "etag: string expected"; + if (message.purpose != null && message.hasOwnProperty("purpose")) + switch (message.purpose) { + default: + return "purpose: enum value expected"; + case 0: + case 1: + break; + } + if (message.purposeData != null && message.hasOwnProperty("purposeData")) { + if (!$util.isObject(message.purposeData)) + return "purposeData: object expected"; + var key = Object.keys(message.purposeData); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.purposeData[key[i]])) + return "purposeData: string{k:string} expected"; + } return null; }; @@ -12298,6 +15059,29 @@ } if (object.etag != null) message.etag = String(object.etag); + switch (object.purpose) { + default: + if (typeof object.purpose === "number") { + message.purpose = object.purpose; + break; + } + break; + case "PURPOSE_UNSPECIFIED": + case 0: + message.purpose = 0; + break; + case "GCE_FIREWALL": + case 1: + message.purpose = 1; + break; + } + if (object.purposeData) { + if (typeof object.purposeData !== "object") + throw TypeError(".google.cloud.resourcemanager.v3.TagKey.purposeData: object expected"); + message.purposeData = {}; + for (var keys = Object.keys(object.purposeData), i = 0; i < keys.length; ++i) + message.purposeData[keys[i]] = String(object.purposeData[keys[i]]); + } return message; }; @@ -12314,6 +15098,8 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.purposeData = {}; if (options.defaults) { object.name = ""; object.parent = ""; @@ -12323,6 +15109,7 @@ object.createTime = null; object.updateTime = null; object.etag = ""; + object.purpose = options.enums === String ? "PURPOSE_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -12340,6 +15127,14 @@ object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); if (message.etag != null && message.hasOwnProperty("etag")) object.etag = message.etag; + if (message.purpose != null && message.hasOwnProperty("purpose")) + object.purpose = options.enums === String ? $root.google.cloud.resourcemanager.v3.Purpose[message.purpose] === undefined ? message.purpose : $root.google.cloud.resourcemanager.v3.Purpose[message.purpose] : message.purpose; + var keys2; + if (message.purposeData && (keys2 = Object.keys(message.purposeData)).length) { + object.purposeData = {}; + for (var j = 0; j < keys2.length; ++j) + object.purposeData[keys2[j]] = message.purposeData[keys2[j]]; + } return object; }; @@ -12842,52 +15637,255 @@ }; /** - * Converts this ListTagKeysResponse to JSON. + * Converts this ListTagKeysResponse to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.ListTagKeysResponse + * @instance + * @returns {Object.} JSON object + */ + ListTagKeysResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListTagKeysResponse + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.ListTagKeysResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListTagKeysResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.ListTagKeysResponse"; + }; + + return ListTagKeysResponse; + })(); + + v3.GetTagKeyRequest = (function() { + + /** + * Properties of a GetTagKeyRequest. + * @memberof google.cloud.resourcemanager.v3 + * @interface IGetTagKeyRequest + * @property {string|null} [name] GetTagKeyRequest name + */ + + /** + * Constructs a new GetTagKeyRequest. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a GetTagKeyRequest. + * @implements IGetTagKeyRequest + * @constructor + * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest=} [properties] Properties to set + */ + function GetTagKeyRequest(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]]; + } + + /** + * GetTagKeyRequest name. + * @member {string} name + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @instance + */ + GetTagKeyRequest.prototype.name = ""; + + /** + * Creates a new GetTagKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @static + * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.GetTagKeyRequest} GetTagKeyRequest instance + */ + GetTagKeyRequest.create = function create(properties) { + return new GetTagKeyRequest(properties); + }; + + /** + * Encodes the specified GetTagKeyRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.GetTagKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @static + * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest} message GetTagKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTagKeyRequest.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 GetTagKeyRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.GetTagKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @static + * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest} message GetTagKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTagKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetTagKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.GetTagKeyRequest} GetTagKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTagKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.GetTagKeyRequest(); + 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 a GetTagKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.GetTagKeyRequest} GetTagKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTagKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetTagKeyRequest message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetTagKeyRequest.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 a GetTagKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.GetTagKeyRequest} GetTagKeyRequest + */ + GetTagKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.GetTagKeyRequest) + return object; + var message = new $root.google.cloud.resourcemanager.v3.GetTagKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetTagKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @static + * @param {google.cloud.resourcemanager.v3.GetTagKeyRequest} message GetTagKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetTagKeyRequest.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 GetTagKeyRequest to JSON. * @function toJSON - * @memberof google.cloud.resourcemanager.v3.ListTagKeysResponse + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest * @instance * @returns {Object.} JSON object */ - ListTagKeysResponse.prototype.toJSON = function toJSON() { + GetTagKeyRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListTagKeysResponse + * Gets the default type url for GetTagKeyRequest * @function getTypeUrl - * @memberof google.cloud.resourcemanager.v3.ListTagKeysResponse + * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListTagKeysResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GetTagKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.resourcemanager.v3.ListTagKeysResponse"; + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.GetTagKeyRequest"; }; - return ListTagKeysResponse; + return GetTagKeyRequest; })(); - v3.GetTagKeyRequest = (function() { + v3.GetNamespacedTagKeyRequest = (function() { /** - * Properties of a GetTagKeyRequest. + * Properties of a GetNamespacedTagKeyRequest. * @memberof google.cloud.resourcemanager.v3 - * @interface IGetTagKeyRequest - * @property {string|null} [name] GetTagKeyRequest name + * @interface IGetNamespacedTagKeyRequest + * @property {string|null} [name] GetNamespacedTagKeyRequest name */ /** - * Constructs a new GetTagKeyRequest. + * Constructs a new GetNamespacedTagKeyRequest. * @memberof google.cloud.resourcemanager.v3 - * @classdesc Represents a GetTagKeyRequest. - * @implements IGetTagKeyRequest + * @classdesc Represents a GetNamespacedTagKeyRequest. + * @implements IGetNamespacedTagKeyRequest * @constructor - * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest=} [properties] Properties to set + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest=} [properties] Properties to set */ - function GetTagKeyRequest(properties) { + function GetNamespacedTagKeyRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12895,35 +15893,35 @@ } /** - * GetTagKeyRequest name. + * GetNamespacedTagKeyRequest name. * @member {string} name - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @instance */ - GetTagKeyRequest.prototype.name = ""; + GetNamespacedTagKeyRequest.prototype.name = ""; /** - * Creates a new GetTagKeyRequest instance using the specified properties. + * Creates a new GetNamespacedTagKeyRequest instance using the specified properties. * @function create - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @static - * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest=} [properties] Properties to set - * @returns {google.cloud.resourcemanager.v3.GetTagKeyRequest} GetTagKeyRequest instance + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest} GetNamespacedTagKeyRequest instance */ - GetTagKeyRequest.create = function create(properties) { - return new GetTagKeyRequest(properties); + GetNamespacedTagKeyRequest.create = function create(properties) { + return new GetNamespacedTagKeyRequest(properties); }; /** - * Encodes the specified GetTagKeyRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.GetTagKeyRequest.verify|verify} messages. + * Encodes the specified GetNamespacedTagKeyRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @static - * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest} message GetTagKeyRequest message or plain object to encode + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest} message GetNamespacedTagKeyRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetTagKeyRequest.encode = function encode(message, writer) { + GetNamespacedTagKeyRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) @@ -12932,33 +15930,33 @@ }; /** - * Encodes the specified GetTagKeyRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.GetTagKeyRequest.verify|verify} messages. + * Encodes the specified GetNamespacedTagKeyRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @static - * @param {google.cloud.resourcemanager.v3.IGetTagKeyRequest} message GetTagKeyRequest message or plain object to encode + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest} message GetNamespacedTagKeyRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetTagKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetNamespacedTagKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetTagKeyRequest message from the specified reader or buffer. + * Decodes a GetNamespacedTagKeyRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.resourcemanager.v3.GetTagKeyRequest} GetTagKeyRequest + * @returns {google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest} GetNamespacedTagKeyRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetTagKeyRequest.decode = function decode(reader, length) { + GetNamespacedTagKeyRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.GetTagKeyRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -12975,30 +15973,30 @@ }; /** - * Decodes a GetTagKeyRequest message from the specified reader or buffer, length delimited. + * Decodes a GetNamespacedTagKeyRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.resourcemanager.v3.GetTagKeyRequest} GetTagKeyRequest + * @returns {google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest} GetNamespacedTagKeyRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetTagKeyRequest.decodeDelimited = function decodeDelimited(reader) { + GetNamespacedTagKeyRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetTagKeyRequest message. + * Verifies a GetNamespacedTagKeyRequest message. * @function verify - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetTagKeyRequest.verify = function verify(message) { + GetNamespacedTagKeyRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) @@ -13008,32 +16006,32 @@ }; /** - * Creates a GetTagKeyRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetNamespacedTagKeyRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.resourcemanager.v3.GetTagKeyRequest} GetTagKeyRequest + * @returns {google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest} GetNamespacedTagKeyRequest */ - GetTagKeyRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.resourcemanager.v3.GetTagKeyRequest) + GetNamespacedTagKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest) return object; - var message = new $root.google.cloud.resourcemanager.v3.GetTagKeyRequest(); + var message = new $root.google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest(); if (object.name != null) message.name = String(object.name); return message; }; /** - * Creates a plain object from a GetTagKeyRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetNamespacedTagKeyRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @static - * @param {google.cloud.resourcemanager.v3.GetTagKeyRequest} message GetTagKeyRequest + * @param {google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest} message GetNamespacedTagKeyRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetTagKeyRequest.toObject = function toObject(message, options) { + GetNamespacedTagKeyRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -13045,32 +16043,32 @@ }; /** - * Converts this GetTagKeyRequest to JSON. + * Converts this GetNamespacedTagKeyRequest to JSON. * @function toJSON - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @instance * @returns {Object.} JSON object */ - GetTagKeyRequest.prototype.toJSON = function toJSON() { + GetNamespacedTagKeyRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for GetTagKeyRequest + * Gets the default type url for GetNamespacedTagKeyRequest * @function getTypeUrl - * @memberof google.cloud.resourcemanager.v3.GetTagKeyRequest + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - GetTagKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GetNamespacedTagKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.resourcemanager.v3.GetTagKeyRequest"; + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest"; }; - return GetTagKeyRequest; + return GetNamespacedTagKeyRequest; })(); v3.CreateTagKeyRequest = (function() { @@ -14340,6 +17338,20 @@ return DeleteTagKeyMetadata; })(); + /** + * Purpose enum. + * @name google.cloud.resourcemanager.v3.Purpose + * @enum {number} + * @property {number} PURPOSE_UNSPECIFIED=0 PURPOSE_UNSPECIFIED value + * @property {number} GCE_FIREWALL=1 GCE_FIREWALL value + */ + v3.Purpose = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PURPOSE_UNSPECIFIED"] = 0; + values[valuesById[1] = "GCE_FIREWALL"] = 1; + return values; + })(); + v3.TagValues = (function() { /** @@ -14438,6 +17450,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.resourcemanager.v3.TagValues|getNamespacedTagValue}. + * @memberof google.cloud.resourcemanager.v3.TagValues + * @typedef GetNamespacedTagValueCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.resourcemanager.v3.TagValue} [response] TagValue + */ + + /** + * Calls GetNamespacedTagValue. + * @function getNamespacedTagValue + * @memberof google.cloud.resourcemanager.v3.TagValues + * @instance + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest} request GetNamespacedTagValueRequest message or plain object + * @param {google.cloud.resourcemanager.v3.TagValues.GetNamespacedTagValueCallback} callback Node-style callback called with the error, if any, and TagValue + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TagValues.prototype.getNamespacedTagValue = function getNamespacedTagValue(request, callback) { + return this.rpcCall(getNamespacedTagValue, $root.google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest, $root.google.cloud.resourcemanager.v3.TagValue, request, callback); + }, "name", { value: "GetNamespacedTagValue" }); + + /** + * Calls GetNamespacedTagValue. + * @function getNamespacedTagValue + * @memberof google.cloud.resourcemanager.v3.TagValues + * @instance + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest} request GetNamespacedTagValueRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.resourcemanager.v3.TagValues|createTagValue}. * @memberof google.cloud.resourcemanager.v3.TagValues @@ -15715,6 +18760,209 @@ return GetTagValueRequest; })(); + v3.GetNamespacedTagValueRequest = (function() { + + /** + * Properties of a GetNamespacedTagValueRequest. + * @memberof google.cloud.resourcemanager.v3 + * @interface IGetNamespacedTagValueRequest + * @property {string|null} [name] GetNamespacedTagValueRequest name + */ + + /** + * Constructs a new GetNamespacedTagValueRequest. + * @memberof google.cloud.resourcemanager.v3 + * @classdesc Represents a GetNamespacedTagValueRequest. + * @implements IGetNamespacedTagValueRequest + * @constructor + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest=} [properties] Properties to set + */ + function GetNamespacedTagValueRequest(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]]; + } + + /** + * GetNamespacedTagValueRequest name. + * @member {string} name + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @instance + */ + GetNamespacedTagValueRequest.prototype.name = ""; + + /** + * Creates a new GetNamespacedTagValueRequest instance using the specified properties. + * @function create + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @static + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest=} [properties] Properties to set + * @returns {google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest} GetNamespacedTagValueRequest instance + */ + GetNamespacedTagValueRequest.create = function create(properties) { + return new GetNamespacedTagValueRequest(properties); + }; + + /** + * Encodes the specified GetNamespacedTagValueRequest message. Does not implicitly {@link google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @static + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest} message GetNamespacedTagValueRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNamespacedTagValueRequest.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 GetNamespacedTagValueRequest message, length delimited. Does not implicitly {@link google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @static + * @param {google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest} message GetNamespacedTagValueRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNamespacedTagValueRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetNamespacedTagValueRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest} GetNamespacedTagValueRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNamespacedTagValueRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest(); + 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 a GetNamespacedTagValueRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest} GetNamespacedTagValueRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNamespacedTagValueRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetNamespacedTagValueRequest message. + * @function verify + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetNamespacedTagValueRequest.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 a GetNamespacedTagValueRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest} GetNamespacedTagValueRequest + */ + GetNamespacedTagValueRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest) + return object; + var message = new $root.google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetNamespacedTagValueRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @static + * @param {google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest} message GetNamespacedTagValueRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetNamespacedTagValueRequest.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 GetNamespacedTagValueRequest to JSON. + * @function toJSON + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @instance + * @returns {Object.} JSON object + */ + GetNamespacedTagValueRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetNamespacedTagValueRequest + * @function getTypeUrl + * @memberof google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetNamespacedTagValueRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest"; + }; + + return GetNamespacedTagValueRequest; + })(); + v3.CreateTagValueRequest = (function() { /** diff --git a/packages/google-cloud-resourcemanager/protos/protos.json b/packages/google-cloud-resourcemanager/protos/protos.json index 848c70cf61df..e1a26c3218de 100644 --- a/packages/google-cloud-resourcemanager/protos/protos.json +++ b/packages/google-cloud-resourcemanager/protos/protos.json @@ -1418,6 +1418,24 @@ } } ] + }, + "ListEffectiveTags": { + "requestType": "ListEffectiveTagsRequest", + "responseType": "ListEffectiveTagsResponse", + "options": { + "(google.api.http).get": "/v3/effectiveTags", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/effectiveTags" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] } } }, @@ -1441,6 +1459,10 @@ "tagValue": { "type": "string", "id": 3 + }, + "tagValueNamespacedName": { + "type": "string", + "id": 4 } } }, @@ -1519,6 +1541,298 @@ } } }, + "ListEffectiveTagsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListEffectiveTagsResponse": { + "fields": { + "effectiveTags": { + "rule": "repeated", + "type": "EffectiveTag", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "EffectiveTag": { + "fields": { + "tagValue": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/TagValue" + } + }, + "namespacedTagValue": { + "type": "string", + "id": 2 + }, + "tagKey": { + "type": "string", + "id": 3, + "options": { + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/TagKey" + } + }, + "namespacedTagKey": { + "type": "string", + "id": 4 + }, + "tagKeyParentName": { + "type": "string", + "id": 6 + }, + "inherited": { + "type": "bool", + "id": 5 + } + } + }, + "TagHolds": { + "options": { + "(google.api.default_host)": "cloudresourcemanager.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-only" + }, + "methods": { + "CreateTagHold": { + "requestType": "CreateTagHoldRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3/{parent=tagValues/*}/tagHolds", + "(google.api.http).body": "tag_hold", + "(google.api.method_signature)": "parent,tag_hold", + "(google.longrunning.operation_info).response_type": "TagHold", + "(google.longrunning.operation_info).metadata_type": "CreateTagHoldMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=tagValues/*}/tagHolds", + "body": "tag_hold" + } + }, + { + "(google.api.method_signature)": "parent,tag_hold" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "TagHold", + "metadata_type": "CreateTagHoldMetadata" + } + } + ] + }, + "DeleteTagHold": { + "requestType": "DeleteTagHoldRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v3/{name=tagValues/*/tagHolds/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteTagHoldMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3/{name=tagValues/*/tagHolds/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteTagHoldMetadata" + } + } + ] + }, + "ListTagHolds": { + "requestType": "ListTagHoldsRequest", + "responseType": "ListTagHoldsResponse", + "options": { + "(google.api.http).get": "/v3/{parent=tagValues/*}/tagHolds", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{parent=tagValues/*}/tagHolds" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "TagHold": { + "options": { + "(google.api.resource).type": "cloudresourcemanager.googleapis.com/TagHold", + "(google.api.resource).pattern": "tagValues/{tag_value}/tagHolds/{tag_hold}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "holder": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "origin": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "helpLink": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CreateTagHoldRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudresourcemanager.googleapis.com/TagHold" + } + }, + "tagHold": { + "type": "TagHold", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "validateOnly": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "CreateTagHoldMetadata": { + "fields": {} + }, + "DeleteTagHoldRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/TagHold" + } + }, + "validateOnly": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteTagHoldMetadata": { + "fields": {} + }, + "ListTagHoldsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudresourcemanager.googleapis.com/TagHold" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListTagHoldsResponse": { + "fields": { + "tagHolds": { + "rule": "repeated", + "type": "TagHold", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, "TagKeys": { "options": { "(google.api.default_host)": "cloudresourcemanager.googleapis.com", @@ -1561,6 +1875,24 @@ } ] }, + "GetNamespacedTagKey": { + "requestType": "GetNamespacedTagKeyRequest", + "responseType": "TagKey", + "options": { + "(google.api.http).get": "/v3/tagKeys/namespaced", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/tagKeys/namespaced" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, "CreateTagKey": { "requestType": "CreateTagKeyRequest", "responseType": "google.longrunning.Operation", @@ -1767,6 +2099,21 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "purpose": { + "type": "Purpose", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "purposeData": { + "keyType": "string", + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -1821,6 +2168,18 @@ } } }, + "GetNamespacedTagKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/TagKey" + } + } + } + }, "CreateTagKeyRequest": { "fields": { "tagKey": { @@ -1893,6 +2252,12 @@ "DeleteTagKeyMetadata": { "fields": {} }, + "Purpose": { + "values": { + "PURPOSE_UNSPECIFIED": 0, + "GCE_FIREWALL": 1 + } + }, "TagValues": { "options": { "(google.api.default_host)": "cloudresourcemanager.googleapis.com", @@ -1935,6 +2300,24 @@ } ] }, + "GetNamespacedTagValue": { + "requestType": "GetNamespacedTagValueRequest", + "responseType": "TagValue", + "options": { + "(google.api.http).get": "/v3/tagValues/namespaced", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/tagValues/namespaced" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, "CreateTagValue": { "requestType": "CreateTagValueRequest", "responseType": "google.longrunning.Operation", @@ -2195,6 +2578,18 @@ } } }, + "GetNamespacedTagValueRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/TagValue" + } + } + } + }, "CreateTagValueRequest": { "fields": { "tagValue": { diff --git a/packages/google-cloud-resourcemanager/samples/README.md b/packages/google-cloud-resourcemanager/samples/README.md index 5caf0e4b025f..b54dc0147a94 100644 --- a/packages/google-cloud-resourcemanager/samples/README.md +++ b/packages/google-cloud-resourcemanager/samples/README.md @@ -41,10 +41,15 @@ * [Projects.update_project](#projects.update_project) * [Tag_bindings.create_tag_binding](#tag_bindings.create_tag_binding) * [Tag_bindings.delete_tag_binding](#tag_bindings.delete_tag_binding) + * [Tag_bindings.list_effective_tags](#tag_bindings.list_effective_tags) * [Tag_bindings.list_tag_bindings](#tag_bindings.list_tag_bindings) + * [Tag_holds.create_tag_hold](#tag_holds.create_tag_hold) + * [Tag_holds.delete_tag_hold](#tag_holds.delete_tag_hold) + * [Tag_holds.list_tag_holds](#tag_holds.list_tag_holds) * [Tag_keys.create_tag_key](#tag_keys.create_tag_key) * [Tag_keys.delete_tag_key](#tag_keys.delete_tag_key) * [Tag_keys.get_iam_policy](#tag_keys.get_iam_policy) + * [Tag_keys.get_namespaced_tag_key](#tag_keys.get_namespaced_tag_key) * [Tag_keys.get_tag_key](#tag_keys.get_tag_key) * [Tag_keys.list_tag_keys](#tag_keys.list_tag_keys) * [Tag_keys.set_iam_policy](#tag_keys.set_iam_policy) @@ -53,6 +58,7 @@ * [Tag_values.create_tag_value](#tag_values.create_tag_value) * [Tag_values.delete_tag_value](#tag_values.delete_tag_value) * [Tag_values.get_iam_policy](#tag_values.get_iam_policy) + * [Tag_values.get_namespaced_tag_value](#tag_values.get_namespaced_tag_value) * [Tag_values.get_tag_value](#tag_values.get_tag_value) * [Tag_values.list_tag_values](#tag_values.list_tag_values) * [Tag_values.set_iam_policy](#tag_values.set_iam_policy) @@ -569,6 +575,23 @@ __Usage:__ +### Tag_bindings.list_effective_tags + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_effective_tags.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_effective_tags.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_effective_tags.js` + + +----- + + + + ### Tag_bindings.list_tag_bindings View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_tag_bindings.js). @@ -586,6 +609,57 @@ __Usage:__ +### Tag_holds.create_tag_hold + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.create_tag_hold.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.create_tag_hold.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.create_tag_hold.js` + + +----- + + + + +### Tag_holds.delete_tag_hold + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.delete_tag_hold.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.delete_tag_hold.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.delete_tag_hold.js` + + +----- + + + + +### Tag_holds.list_tag_holds + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.list_tag_holds.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.list_tag_holds.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.list_tag_holds.js` + + +----- + + + + ### Tag_keys.create_tag_key View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.create_tag_key.js). @@ -637,6 +711,23 @@ __Usage:__ +### Tag_keys.get_namespaced_tag_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_namespaced_tag_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_namespaced_tag_key.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_namespaced_tag_key.js` + + +----- + + + + ### Tag_keys.get_tag_key View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_tag_key.js). @@ -773,6 +864,23 @@ __Usage:__ +### Tag_values.get_namespaced_tag_value + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_namespaced_tag_value.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_namespaced_tag_value.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_namespaced_tag_value.js` + + +----- + + + + ### Tag_values.get_tag_value View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_tag_value.js). diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.create_folder.js b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.create_folder.js index 1ecff8296320..8a5c38722770 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.create_folder.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.create_folder.js @@ -29,8 +29,8 @@ function main(folder) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The folder being created, only the display name and parent will be - * consulted. All other fields will be ignored. + * Required. The folder being created, only the display name and parent will + * be consulted. All other fields will be ignored. */ // const folder = {} diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.list_folders.js b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.list_folders.js index 1a3769fad2fa..ace19a6ceb76 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.list_folders.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.list_folders.js @@ -29,16 +29,19 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name of the organization or folder whose folders are - * being listed. - * Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. + * Required. The name of the parent resource whose folders are being listed. + * Only children of this parent resource are listed; descendants are not + * listed. + * If the parent is a folder, use the value `folders/{folder_id}`. If the + * parent is an organization, use the value `organizations/{org_id}`. * Access to this method is controlled by checking the * `resourcemanager.folders.list` permission on the `parent`. */ // const parent = 'abc123' /** - * Optional. The maximum number of folders to return in the response. - * If unspecified, server picks an appropriate default. + * Optional. The maximum number of folders to return in the response. The + * server can return fewer folders than requested. If unspecified, server + * picks an appropriate default. */ // const pageSize = 1234 /** diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.move_folder.js b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.move_folder.js index 9560c8b691a1..b279ea6393a0 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.move_folder.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.move_folder.js @@ -34,9 +34,9 @@ function main(name, destinationParent) { */ // const name = 'abc123' /** - * Required. The resource name of the folder or organization which should be the - * folder's new parent. - * Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. + * Required. The resource name of the folder or organization which should be + * the folder's new parent. Must be of the form `folders/{folder_id}` or + * `organizations/{org_id}`. */ // const destinationParent = 'abc123' diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.search_folders.js b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.search_folders.js index e7d622ab05f3..4cc9c93c7f34 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.search_folders.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.search_folders.js @@ -29,13 +29,14 @@ function main() { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Optional. The maximum number of folders to return in the response. - * If unspecified, server picks an appropriate default. + * Optional. The maximum number of folders to return in the response. The + * server can return fewer folders than requested. If unspecified, server + * picks an appropriate default. */ // const pageSize = 1234 /** - * Optional. A pagination token returned from a previous call to `SearchFolders` - * that indicates from where search should continue. + * Optional. A pagination token returned from a previous call to + * `SearchFolders` that indicates from where search should continue. */ // const pageToken = 'abc123' /** diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.update_folder.js b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.update_folder.js index 5d0789d64864..40d265b5847c 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/folders.update_folder.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/folders.update_folder.js @@ -29,8 +29,8 @@ function main(folder, updateMask) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The new definition of the Folder. It must include the `name` field, which - * cannot be changed. + * Required. The new definition of the Folder. It must include the `name` + * field, which cannot be changed. */ // const folder = {} /** diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/organizations.get_organization.js b/packages/google-cloud-resourcemanager/samples/generated/v3/organizations.get_organization.js index 4dd10b25c694..674d25d155a9 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/organizations.get_organization.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/organizations.get_organization.js @@ -29,9 +29,9 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name of the Organization to fetch. This is the organization's - * relative path in the API, formatted as "organizations/[organizationId]". - * For example, "organizations/1234". + * Required. The resource name of the Organization to fetch. This is the + * organization's relative path in the API, formatted as + * "organizations/[organizationId]". For example, "organizations/1234". */ // const name = 'abc123' diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/organizations.search_organizations.js b/packages/google-cloud-resourcemanager/samples/generated/v3/organizations.search_organizations.js index 048ba0bec6b1..25a484a1d21e 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/organizations.search_organizations.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/organizations.search_organizations.js @@ -30,17 +30,18 @@ function main() { */ /** * Optional. The maximum number of organizations to return in the response. - * If unspecified, server picks an appropriate default. + * The server can return fewer organizations than requested. If unspecified, + * server picks an appropriate default. */ // const pageSize = 1234 /** - * Optional. A pagination token returned from a previous call to `SearchOrganizations` - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * `SearchOrganizations` that indicates from where listing should continue. */ // const pageToken = 'abc123' /** - * Optional. An optional query string used to filter the Organizations to return in - * the response. Query rules are case-insensitive. + * Optional. An optional query string used to filter the Organizations to + * return in the response. Query rules are case-insensitive. * ``` * | Field | Description | * |------------------|--------------------------------------------| diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/projects.create_project.js b/packages/google-cloud-resourcemanager/samples/generated/v3/projects.create_project.js index ba2ee13cb4dd..73a6f5a6e675 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/projects.create_project.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/projects.create_project.js @@ -34,7 +34,7 @@ function main(project) { * fails. * If the `parent` field is set, the `resourcemanager.projects.create` * permission is checked on the parent resource. If no parent is set and - * the authorization credentials belong to an Organziation, the parent + * the authorization credentials belong to an Organization, the parent * will be set to that Organization. */ // const project = 'my-project' diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/projects.list_projects.js b/packages/google-cloud-resourcemanager/samples/generated/v3/projects.list_projects.js index 5febda736d25..826637d500b3 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/projects.list_projects.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/projects.list_projects.js @@ -29,15 +29,17 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The name of the parent resource to list projects under. - * For example, setting this field to 'folders/1234' would list all projects - * directly under that folder. + * Required. The name of the parent resource whose projects are being listed. + * Only children of this parent resource are listed; descendants are not + * listed. + * If the parent is a folder, use the value `folders/{folder_id}`. If the + * parent is an organization, use the value `organizations/{org_id}`. */ // const parent = 'abc123' /** - * Optional. A pagination token returned from a previous call to ListProjects - * google.cloud.resourcemanager.v3.Projects.ListProjects - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * ListProjects google.cloud.resourcemanager.v3.Projects.ListProjects that + * indicates from where listing should continue. */ // const pageToken = 'abc123' /** @@ -47,8 +49,8 @@ function main(parent) { */ // const pageSize = 1234 /** - * Optional. Indicate that projects in the `DELETE_REQUESTED` state should also be - * returned. Normally only `ACTIVE` projects are returned. + * Optional. Indicate that projects in the `DELETE_REQUESTED` state should + * also be returned. Normally only `ACTIVE` projects are returned. */ // const showDeleted = true diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/projects.search_projects.js b/packages/google-cloud-resourcemanager/samples/generated/v3/projects.search_projects.js index fe41471f53f2..ecf83ab83d41 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/projects.search_projects.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/projects.search_projects.js @@ -31,21 +31,21 @@ function main() { /** * Optional. A query string for searching for projects that the caller has * `resourcemanager.projects.get` permission to. If multiple fields are - * included in the query, the it will return results that match any of the + * included in the query, then it will return results that match any of the * fields. Some eligible fields are: * ``` * | Field | Description | * |-------------------------|----------------------------------------------| * | displayName, name | Filters by displayName. | - * | parent | Project's parent. (for example: folders/123, - * organizations/*) Prefer parent field over parent.type and parent.id. | - * | parent.type | Parent's type: `folder` or `organization`. | - * | parent.id | Parent's id number (for example: 123) | - * | id, projectId | Filters by projectId. | - * | state, lifecycleState | Filters by state. | - * | labels | Filters by label name or value. | - * | labels. (where *key* is the name of a label) | Filters by label - * name. | + * | parent | Project's parent (for example: folders/123, + * organizations/*). Prefer parent field over parent.type and parent.id.| | + * parent.type | Parent's type: `folder` or `organization`. | | + * parent.id | Parent's id number (for example: 123) | | + * id, projectId | Filters by projectId. | | + * state, lifecycleState | Filters by state. | | + * labels | Filters by label name or value. | | + * labels.\ (where *key* is the name of a label) | Filters by label + * name.| * ``` * Search expressions are case insensitive. * Some examples queries: @@ -58,17 +58,17 @@ function main() { * | NAME:howl | Equivalent to above. | * | labels.color:* | The project has the label `color`. | * | labels.color:red | The project's label `color` has the value `red`. | - * | labels.color:red labels.size:big | The project's label `color` has - * the value `red` and its label `size` has the value `big`. | + * | labels.color:red labels.size:big | The project's label `color` has the + * value `red` or its label `size` has the value `big`. | * ``` * If no query is specified, the call will return projects for which the user * has the `resourcemanager.projects.get` permission. */ // const query = 'abc123' /** - * Optional. A pagination token returned from a previous call to ListProjects - * google.cloud.resourcemanager.v3.Projects.ListProjects - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * ListProjects google.cloud.resourcemanager.v3.Projects.ListProjects that + * indicates from where listing should continue. */ // const pageToken = 'abc123' /** diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/snippet_metadata.google.cloud.resourcemanager.v3.json b/packages/google-cloud-resourcemanager/samples/generated/v3/snippet_metadata.google.cloud.resourcemanager.v3.json index b17c24b49657..3ee3661fc43e 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/snippet_metadata.google.cloud.resourcemanager.v3.json +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/snippet_metadata.google.cloud.resourcemanager.v3.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-resourcemanager", - "version": "4.2.0", + "version": "4.2.2", "language": "TYPESCRIPT", "apis": [ { @@ -62,7 +62,7 @@ "segments": [ { "start": 25, - "end": 75, + "end": 78, "type": "FULL" } ], @@ -114,7 +114,7 @@ "segments": [ { "start": 25, - "end": 89, + "end": 90, "type": "FULL" } ], @@ -546,7 +546,7 @@ "segments": [ { "start": 25, - "end": 78, + "end": 79, "type": "FULL" } ], @@ -770,7 +770,7 @@ "segments": [ { "start": 25, - "end": 74, + "end": 76, "type": "FULL" } ], @@ -947,7 +947,7 @@ "regionTag": "cloudresourcemanager_v3_generated_Projects_MoveProject_async", "title": "Folders moveProject Sample", "origin": "API_DEFINITION", - "description": " Move a project to another place in your resource hierarchy, under a new resource parent. Returns an operation which can be used to track the process of the project move workflow. Upon success, the `Operation.response` field will be populated with the moved project. The caller must have `resourcemanager.projects.update` permission on the project and have `resourcemanager.projects.move` permission on the project's current and proposed new parent.", + "description": " Move a project to another place in your resource hierarchy, under a new resource parent. Returns an operation which can be used to track the process of the project move workflow. Upon success, the `Operation.response` field will be populated with the moved project. The caller must have `resourcemanager.projects.move` permission on the project, on the project's current and proposed new parent. If project has no current parent, or it currently does not have an associated organization resource, you will also need the `resourcemanager.projects.setIamPolicy` permission in the project.", "canonical": true, "file": "projects.move_project.js", "language": "JAVASCRIPT", @@ -1071,7 +1071,7 @@ "regionTag": "cloudresourcemanager_v3_generated_Projects_GetIamPolicy_async", "title": "Folders getIamPolicy Sample", "origin": "API_DEFINITION", - "description": " Returns the IAM access control policy for the specified project. Permission is denied if the policy or the resource do not exist.", + "description": " Returns the IAM access control policy for the specified project, in the format `projects/{ProjectIdOrNumber}` e.g. projects/123. Permission is denied if the policy or the resource do not exist.", "canonical": true, "file": "projects.get_iam_policy.js", "language": "JAVASCRIPT", @@ -1115,7 +1115,7 @@ "regionTag": "cloudresourcemanager_v3_generated_Projects_SetIamPolicy_async", "title": "Folders setIamPolicy Sample", "origin": "API_DEFINITION", - "description": " Sets the IAM access control policy for the specified project. CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted to a `user`, `serviceAccount`, or a group that is part of an organization. For example, group@myownpersonaldomain.com could be added as an owner to a project in the myownpersonaldomain.com organization, but not the examplepetstore.com organization. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited using the Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + If the project is not part of an organization, there must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API.", + "description": " Sets the IAM access control policy for the specified project, in the format `projects/{ProjectIdOrNumber}` e.g. projects/123. CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted to a `user`, `serviceAccount`, or a group that is part of an organization. For example, group@myownpersonaldomain.com could be added as an owner to a project in the myownpersonaldomain.com organization, but not the examplepetstore.com organization. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited using the Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + If the project is not part of an organization, there must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. If the project is part of an organization, you can remove all owners, potentially making the organization inaccessible.", "canonical": true, "file": "projects.set_iam_policy.js", "language": "JAVASCRIPT", @@ -1163,7 +1163,7 @@ "regionTag": "cloudresourcemanager_v3_generated_Projects_TestIamPermissions_async", "title": "Folders testIamPermissions Sample", "origin": "API_DEFINITION", - "description": " Returns permissions that a caller has on the specified project.", + "description": " Returns permissions that a caller has on the specified project, in the format `projects/{ProjectIdOrNumber}` e.g. projects/123..", "canonical": true, "file": "projects.test_iam_permissions.js", "language": "JAVASCRIPT", @@ -1207,7 +1207,7 @@ "regionTag": "cloudresourcemanager_v3_generated_TagBindings_ListTagBindings_async", "title": "Folders listTagBindings Sample", "origin": "API_DEFINITION", - "description": " Lists the TagBindings for the given cloud resource, as specified with `parent`. NOTE: The `parent` field is expected to be a full resource name: https://cloud.google.com/apis/design/resource_names#full_resource_name", + "description": " Lists the TagBindings for the given Google Cloud resource, as specified with `parent`. NOTE: The `parent` field is expected to be a full resource name: https://cloud.google.com/apis/design/resource_names#full_resource_name", "canonical": true, "file": "tag_bindings.list_tag_bindings.js", "language": "JAVASCRIPT", @@ -1255,7 +1255,7 @@ "regionTag": "cloudresourcemanager_v3_generated_TagBindings_CreateTagBinding_async", "title": "Folders createTagBinding Sample", "origin": "API_DEFINITION", - "description": " Creates a TagBinding between a TagValue and a cloud resource (currently project, folder, or organization).", + "description": " Creates a TagBinding between a TagValue and a Google Cloud resource.", "canonical": true, "file": "tag_bindings.create_tag_binding.js", "language": "JAVASCRIPT", @@ -1335,6 +1335,198 @@ } } }, + { + "regionTag": "cloudresourcemanager_v3_generated_TagBindings_ListEffectiveTags_async", + "title": "Folders listEffectiveTags Sample", + "origin": "API_DEFINITION", + "description": " Return a list of effective tags for the given Google Cloud resource, as specified in `parent`.", + "canonical": true, + "file": "tag_bindings.list_effective_tags.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEffectiveTags", + "fullName": "google.cloud.resourcemanager.v3.TagBindings.ListEffectiveTags", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.resourcemanager.v3.ListEffectiveTagsResponse", + "client": { + "shortName": "TagBindingsClient", + "fullName": "google.cloud.resourcemanager.v3.TagBindingsClient" + }, + "method": { + "shortName": "ListEffectiveTags", + "fullName": "google.cloud.resourcemanager.v3.TagBindings.ListEffectiveTags", + "service": { + "shortName": "TagBindings", + "fullName": "google.cloud.resourcemanager.v3.TagBindings" + } + } + } + }, + { + "regionTag": "cloudresourcemanager_v3_generated_TagHolds_CreateTagHold_async", + "title": "Folders createTagHold Sample", + "origin": "API_DEFINITION", + "description": " Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same resource and origin exists under the same TagValue.", + "canonical": true, + "file": "tag_holds.create_tag_hold.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateTagHold", + "fullName": "google.cloud.resourcemanager.v3.TagHolds.CreateTagHold", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "tag_hold", + "type": ".google.cloud.resourcemanager.v3.TagHold" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TagHoldsClient", + "fullName": "google.cloud.resourcemanager.v3.TagHoldsClient" + }, + "method": { + "shortName": "CreateTagHold", + "fullName": "google.cloud.resourcemanager.v3.TagHolds.CreateTagHold", + "service": { + "shortName": "TagHolds", + "fullName": "google.cloud.resourcemanager.v3.TagHolds" + } + } + } + }, + { + "regionTag": "cloudresourcemanager_v3_generated_TagHolds_DeleteTagHold_async", + "title": "Folders deleteTagHold Sample", + "origin": "API_DEFINITION", + "description": " Deletes a TagHold.", + "canonical": true, + "file": "tag_holds.delete_tag_hold.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteTagHold", + "fullName": "google.cloud.resourcemanager.v3.TagHolds.DeleteTagHold", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TagHoldsClient", + "fullName": "google.cloud.resourcemanager.v3.TagHoldsClient" + }, + "method": { + "shortName": "DeleteTagHold", + "fullName": "google.cloud.resourcemanager.v3.TagHolds.DeleteTagHold", + "service": { + "shortName": "TagHolds", + "fullName": "google.cloud.resourcemanager.v3.TagHolds" + } + } + } + }, + { + "regionTag": "cloudresourcemanager_v3_generated_TagHolds_ListTagHolds_async", + "title": "Folders listTagHolds Sample", + "origin": "API_DEFINITION", + "description": " Lists TagHolds under a TagValue.", + "canonical": true, + "file": "tag_holds.list_tag_holds.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListTagHolds", + "fullName": "google.cloud.resourcemanager.v3.TagHolds.ListTagHolds", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.resourcemanager.v3.ListTagHoldsResponse", + "client": { + "shortName": "TagHoldsClient", + "fullName": "google.cloud.resourcemanager.v3.TagHoldsClient" + }, + "method": { + "shortName": "ListTagHolds", + "fullName": "google.cloud.resourcemanager.v3.TagHolds.ListTagHolds", + "service": { + "shortName": "TagHolds", + "fullName": "google.cloud.resourcemanager.v3.TagHolds" + } + } + } + }, { "regionTag": "cloudresourcemanager_v3_generated_TagKeys_ListTagKeys_async", "title": "Folders listTagKeys Sample", @@ -1423,11 +1615,51 @@ } } }, + { + "regionTag": "cloudresourcemanager_v3_generated_TagKeys_GetNamespacedTagKey_async", + "title": "Folders getNamespacedTagKey Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a TagKey by its namespaced name. This method will return `PERMISSION_DENIED` if the key does not exist or the user does not have permission to view it.", + "canonical": true, + "file": "tag_keys.get_namespaced_tag_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNamespacedTagKey", + "fullName": "google.cloud.resourcemanager.v3.TagKeys.GetNamespacedTagKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.resourcemanager.v3.TagKey", + "client": { + "shortName": "TagKeysClient", + "fullName": "google.cloud.resourcemanager.v3.TagKeysClient" + }, + "method": { + "shortName": "GetNamespacedTagKey", + "fullName": "google.cloud.resourcemanager.v3.TagKeys.GetNamespacedTagKey", + "service": { + "shortName": "TagKeys", + "fullName": "google.cloud.resourcemanager.v3.TagKeys" + } + } + } + }, { "regionTag": "cloudresourcemanager_v3_generated_TagKeys_CreateTagKey_async", "title": "Folders createTagKey Sample", "origin": "API_DEFINITION", - "description": " Creates a new TagKey. If another request with the same parameters is sent while the original request is in process, the second request will receive an error. A maximum of 300 TagKeys can exist under a parent at any given time.", + "description": " Creates a new TagKey. If another request with the same parameters is sent while the original request is in process, the second request will receive an error. A maximum of 1000 TagKeys can exist under a parent at any given time.", "canonical": true, "file": "tag_keys.create_tag_key.js", "language": "JAVASCRIPT", @@ -1710,7 +1942,7 @@ "segments": [ { "start": 25, - "end": 67, + "end": 66, "type": "FULL" } ], @@ -1751,14 +1983,14 @@ "regionTag": "cloudresourcemanager_v3_generated_TagValues_GetTagValue_async", "title": "Folders getTagValue Sample", "origin": "API_DEFINITION", - "description": " Retrieves TagValue. If the TagValue or namespaced name does not exist, or if the user does not have permission to view it, this method will return `PERMISSION_DENIED`.", + "description": " Retrieves a TagValue. This method will return `PERMISSION_DENIED` if the value does not exist or the user does not have permission to view it.", "canonical": true, "file": "tag_values.get_tag_value.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 53, + "end": 54, "type": "FULL" } ], @@ -1787,11 +2019,51 @@ } } }, + { + "regionTag": "cloudresourcemanager_v3_generated_TagValues_GetNamespacedTagValue_async", + "title": "Folders getNamespacedTagValue Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a TagValue by its namespaced name. This method will return `PERMISSION_DENIED` if the value does not exist or the user does not have permission to view it.", + "canonical": true, + "file": "tag_values.get_namespaced_tag_value.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNamespacedTagValue", + "fullName": "google.cloud.resourcemanager.v3.TagValues.GetNamespacedTagValue", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.resourcemanager.v3.TagValue", + "client": { + "shortName": "TagValuesClient", + "fullName": "google.cloud.resourcemanager.v3.TagValuesClient" + }, + "method": { + "shortName": "GetNamespacedTagValue", + "fullName": "google.cloud.resourcemanager.v3.TagValues.GetNamespacedTagValue", + "service": { + "shortName": "TagValues", + "fullName": "google.cloud.resourcemanager.v3.TagValues" + } + } + } + }, { "regionTag": "cloudresourcemanager_v3_generated_TagValues_CreateTagValue_async", "title": "Folders createTagValue Sample", "origin": "API_DEFINITION", - "description": " Creates a TagValue as a child of the specified TagKey. If a another request with the same parameters is sent while the original request is in process the second request will receive an error. A maximum of 300 TagValues can exist under a TagKey at any given time.", + "description": " Creates a TagValue as a child of the specified TagKey. If a another request with the same parameters is sent while the original request is in process the second request will receive an error. A maximum of 1000 TagValues can exist under a TagKey at any given time.", "canonical": true, "file": "tag_values.create_tag_value.js", "language": "JAVASCRIPT", @@ -1890,7 +2162,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 65, "type": "FULL" } ], diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.create_tag_binding.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.create_tag_binding.js index 30499cdc8a9a..ad6a21660431 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.create_tag_binding.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.create_tag_binding.js @@ -33,8 +33,8 @@ function main(tagBinding) { */ // const tagBinding = {} /** - * Optional. Set to true to perform the validations necessary for creating the resource, - * but not actually perform the action. + * Optional. Set to true to perform the validations necessary for creating the + * resource, but not actually perform the action. */ // const validateOnly = true diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_effective_tags.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_effective_tags.js new file mode 100644 index 000000000000..fb1d0a24397a --- /dev/null +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_effective_tags.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudresourcemanager_v3_generated_TagBindings_ListEffectiveTags_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The full resource name of a resource for which you want to list + * the effective tags. E.g. + * "//cloudresourcemanager.googleapis.com/projects/123" + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of effective tags to return in the response. + * The server allows a maximum of 300 effective tags to return in a single + * page. If unspecified, the server will use 100 as the default. + */ + // const pageSize = 1234 + /** + * Optional. A pagination token returned from a previous call to + * `ListEffectiveTags` that indicates from where this listing should continue. + */ + // const pageToken = 'abc123' + + // Imports the Resourcemanager library + const {TagBindingsClient} = require('@google-cloud/resource-manager').v3; + + // Instantiates a client + const resourcemanagerClient = new TagBindingsClient(); + + async function callListEffectiveTags() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await resourcemanagerClient.listEffectiveTagsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEffectiveTags(); + // [END cloudresourcemanager_v3_generated_TagBindings_ListEffectiveTags_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_tag_bindings.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_tag_bindings.js index 77b3d29da32f..5858d932c6c9 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_tag_bindings.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_bindings.list_tag_bindings.js @@ -29,20 +29,20 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The full resource name of a resource for which you want to list existing - * TagBindings. - * E.g. "//cloudresourcemanager.googleapis.com/projects/123" + * Required. The full resource name of a resource for which you want to list + * existing TagBindings. E.g. + * "//cloudresourcemanager.googleapis.com/projects/123" */ // const parent = 'abc123' /** - * Optional. The maximum number of TagBindings to return in the response. The server - * allows a maximum of 300 TagBindings to return. If unspecified, the server - * will use 100 as the default. + * Optional. The maximum number of TagBindings to return in the response. The + * server allows a maximum of 300 TagBindings to return. If unspecified, the + * server will use 100 as the default. */ // const pageSize = 1234 /** - * Optional. A pagination token returned from a previous call to `ListTagBindings` - * that indicates where this listing should continue from. + * Optional. A pagination token returned from a previous call to + * `ListTagBindings` that indicates where this listing should continue from. */ // const pageToken = 'abc123' diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.create_tag_hold.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.create_tag_hold.js new file mode 100644 index 000000000000..ff05a49aa500 --- /dev/null +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.create_tag_hold.js @@ -0,0 +1,73 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, tagHold) { + // [START cloudresourcemanager_v3_generated_TagHolds_CreateTagHold_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the TagHold's parent TagValue. Must be of + * the form: `tagValues/{tag-value-id}`. + */ + // const parent = 'abc123' + /** + * Required. The TagHold to be created. + */ + // const tagHold = {} + /** + * Optional. Set to true to perform the validations necessary for creating the + * resource, but not actually perform the action. + */ + // const validateOnly = true + + // Imports the Resourcemanager library + const {TagHoldsClient} = require('@google-cloud/resource-manager').v3; + + // Instantiates a client + const resourcemanagerClient = new TagHoldsClient(); + + async function callCreateTagHold() { + // Construct request + const request = { + parent, + tagHold, + }; + + // Run request + const [operation] = await resourcemanagerClient.createTagHold(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateTagHold(); + // [END cloudresourcemanager_v3_generated_TagHolds_CreateTagHold_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.delete_tag_hold.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.delete_tag_hold.js new file mode 100644 index 000000000000..4d6a10c5f978 --- /dev/null +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.delete_tag_hold.js @@ -0,0 +1,68 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudresourcemanager_v3_generated_TagHolds_DeleteTagHold_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the TagHold to delete. Must be of the form: + * `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}`. + */ + // const name = 'abc123' + /** + * Optional. Set to true to perform the validations necessary for deleting the + * resource, but not actually perform the action. + */ + // const validateOnly = true + + // Imports the Resourcemanager library + const {TagHoldsClient} = require('@google-cloud/resource-manager').v3; + + // Instantiates a client + const resourcemanagerClient = new TagHoldsClient(); + + async function callDeleteTagHold() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await resourcemanagerClient.deleteTagHold(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteTagHold(); + // [END cloudresourcemanager_v3_generated_TagHolds_DeleteTagHold_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.list_tag_holds.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.list_tag_holds.js new file mode 100644 index 000000000000..d40a1c095ce5 --- /dev/null +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_holds.list_tag_holds.js @@ -0,0 +1,88 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudresourcemanager_v3_generated_TagHolds_ListTagHolds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the parent TagValue. Must be of the form: + * `tagValues/{tag-value-id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of TagHolds to return in the response. The + * server allows a maximum of 300 TagHolds to return. If unspecified, the + * server will use 100 as the default. + */ + // const pageSize = 1234 + /** + * Optional. A pagination token returned from a previous call to + * `ListTagHolds` that indicates where this listing should continue from. + */ + // const pageToken = 'abc123' + /** + * Optional. Criteria used to select a subset of TagHolds parented by the + * TagValue to return. This field follows the syntax defined by aip.dev/160; + * the `holder` and `origin` fields are supported for filtering. Currently + * only `AND` syntax is supported. Some example queries are: + * * `holder = + * //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group` + * * `origin = 35678234` + * * `holder = + * //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group + * AND origin = 35678234` + */ + // const filter = 'abc123' + + // Imports the Resourcemanager library + const {TagHoldsClient} = require('@google-cloud/resource-manager').v3; + + // Instantiates a client + const resourcemanagerClient = new TagHoldsClient(); + + async function callListTagHolds() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await resourcemanagerClient.listTagHoldsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListTagHolds(); + // [END cloudresourcemanager_v3_generated_TagHolds_ListTagHolds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.create_tag_key.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.create_tag_key.js index 5b0ab9e3ccba..b54df2533354 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.create_tag_key.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.create_tag_key.js @@ -29,13 +29,13 @@ function main(tagKey) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The TagKey to be created. Only fields `short_name`, `description`, - * and `parent` are considered during the creation request. + * Required. The TagKey to be created. Only fields `short_name`, + * `description`, and `parent` are considered during the creation request. */ // const tagKey = {} /** - * Optional. Set to true to perform validations necessary for creating the resource, but - * not actually perform the action. + * Optional. Set to true to perform validations necessary for creating the + * resource, but not actually perform the action. */ // const validateOnly = true diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.delete_tag_key.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.delete_tag_key.js index c2647d6efae0..d9b671be8289 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.delete_tag_key.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.delete_tag_key.js @@ -29,19 +29,19 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name of a TagKey to be deleted in the format `tagKeys/123`. - * The TagKey cannot be a parent of any existing TagValues or it will not be - * deleted successfully. + * Required. The resource name of a TagKey to be deleted in the format + * `tagKeys/123`. The TagKey cannot be a parent of any existing TagValues or + * it will not be deleted successfully. */ // const name = 'abc123' /** - * Optional. Set as true to perform validations necessary for deletion, but not actually - * perform the action. + * Optional. Set as true to perform validations necessary for deletion, but + * not actually perform the action. */ // const validateOnly = true /** - * Optional. The etag known to the client for the expected state of the TagKey. This is - * to be used for optimistic concurrency. + * Optional. The etag known to the client for the expected state of the + * TagKey. This is to be used for optimistic concurrency. */ // const etag = 'abc123' diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_namespaced_tag_key.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_namespaced_tag_key.js new file mode 100644 index 000000000000..7861fabb92b4 --- /dev/null +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.get_namespaced_tag_key.js @@ -0,0 +1,64 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudresourcemanager_v3_generated_TagKeys_GetNamespacedTagKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A namespaced tag key name in the format + * `{parentId}/{tagKeyShort}`, such as `42/foo` for a key with short name + * "foo" under the organization with ID 42 or `r2-d2/bar` for a key with short + * name "bar" under the project `r2-d2`. + */ + // const name = 'abc123' + + // Imports the Resourcemanager library + const {TagKeysClient} = require('@google-cloud/resource-manager').v3; + + // Instantiates a client + const resourcemanagerClient = new TagKeysClient(); + + async function callGetNamespacedTagKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await resourcemanagerClient.getNamespacedTagKey(request); + console.log(response); + } + + callGetNamespacedTagKey(); + // [END cloudresourcemanager_v3_generated_TagKeys_GetNamespacedTagKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.list_tag_keys.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.list_tag_keys.js index 96239d69a0be..1f2a32ab108e 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.list_tag_keys.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.list_tag_keys.js @@ -34,9 +34,9 @@ function main(parent) { */ // const parent = 'abc123' /** - * Optional. The maximum number of TagKeys to return in the response. The server allows - * a maximum of 300 TagKeys to return. If unspecified, the server will use 100 - * as the default. + * Optional. The maximum number of TagKeys to return in the response. The + * server allows a maximum of 300 TagKeys to return. If unspecified, the + * server will use 100 as the default. */ // const pageSize = 1234 /** diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.update_tag_key.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.update_tag_key.js index e38ee8dddfc6..3c3eca4f3a71 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.update_tag_key.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_keys.update_tag_key.js @@ -29,10 +29,10 @@ function main(tagKey) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The new definition of the TagKey. Only the `description` and `etag` fields - * can be updated by this request. If the `etag` field is not empty, it - * must match the `etag` field of the existing tag key. Otherwise, - * `FAILED_PRECONDITION` will be returned. + * Required. The new definition of the TagKey. Only the `description` and + * `etag` fields can be updated by this request. If the `etag` field is not + * empty, it must match the `etag` field of the existing tag key. Otherwise, + * `ABORTED` will be returned. */ // const tagKey = {} /** diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.create_tag_value.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.create_tag_value.js index b770acf3fa80..63f9675d3efb 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.create_tag_value.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.create_tag_value.js @@ -29,13 +29,13 @@ function main(tagValue) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The TagValue to be created. Only fields `short_name`, `description`, - * and `parent` are considered during the creation request. + * Required. The TagValue to be created. Only fields `short_name`, + * `description`, and `parent` are considered during the creation request. */ // const tagValue = {} /** - * Optional. Set as true to perform the validations necessary for creating the resource, - * but not actually perform the action. + * Optional. Set as true to perform the validations necessary for creating the + * resource, but not actually perform the action. */ // const validateOnly = true diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.delete_tag_value.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.delete_tag_value.js index a6b6f2709586..1f0b1b768ad2 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.delete_tag_value.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.delete_tag_value.js @@ -29,17 +29,18 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. Resource name for TagValue to be deleted in the format tagValues/456. + * Required. Resource name for TagValue to be deleted in the format + * tagValues/456. */ // const name = 'abc123' /** - * Optional. Set as true to perform the validations necessary for deletion, but not - * actually perform the action. + * Optional. Set as true to perform the validations necessary for deletion, + * but not actually perform the action. */ // const validateOnly = true /** - * Optional. The etag known to the client for the expected state of the TagValue. This - * is to be used for optimistic concurrency. + * Optional. The etag known to the client for the expected state of the + * TagValue. This is to be used for optimistic concurrency. */ // const etag = 'abc123' diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_namespaced_tag_value.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_namespaced_tag_value.js new file mode 100644 index 000000000000..019c16379c3b --- /dev/null +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_namespaced_tag_value.js @@ -0,0 +1,67 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudresourcemanager_v3_generated_TagValues_GetNamespacedTagValue_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A namespaced tag value name in the following format: + * `{parentId}/{tagKeyShort}/{tagValueShort}` + * Examples: + * - `42/foo/abc` for a value with short name "abc" under the key with short + * name "foo" under the organization with ID 42 + * - `r2-d2/bar/xyz` for a value with short name "xyz" under the key with + * short name "bar" under the project with ID "r2-d2" + */ + // const name = 'abc123' + + // Imports the Resourcemanager library + const {TagValuesClient} = require('@google-cloud/resource-manager').v3; + + // Instantiates a client + const resourcemanagerClient = new TagValuesClient(); + + async function callGetNamespacedTagValue() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await resourcemanagerClient.getNamespacedTagValue(request); + console.log(response); + } + + callGetNamespacedTagValue(); + // [END cloudresourcemanager_v3_generated_TagValues_GetNamespacedTagValue_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_tag_value.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_tag_value.js index 96dbe57f51fa..42eedb7b8072 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_tag_value.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.get_tag_value.js @@ -29,7 +29,8 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. Resource name for TagValue to be fetched in the format `tagValues/456`. + * Required. Resource name for TagValue to be fetched in the format + * `tagValues/456`. */ // const name = 'abc123' diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.list_tag_values.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.list_tag_values.js index ca0b3c2387ad..fef7f2b88b1c 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.list_tag_values.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.list_tag_values.js @@ -29,19 +29,18 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. Resource name for TagKey, parent of the TagValues to be listed, - * in the format `tagKeys/123`. + * Required. */ // const parent = 'abc123' /** - * Optional. The maximum number of TagValues to return in the response. The server - * allows a maximum of 300 TagValues to return. If unspecified, the server - * will use 100 as the default. + * Optional. The maximum number of TagValues to return in the response. The + * server allows a maximum of 300 TagValues to return. If unspecified, the + * server will use 100 as the default. */ // const pageSize = 1234 /** - * Optional. A pagination token returned from a previous call to `ListTagValues` - * that indicates where this listing should continue from. + * Optional. A pagination token returned from a previous call to + * `ListTagValues` that indicates where this listing should continue from. */ // const pageToken = 'abc123' diff --git a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.update_tag_value.js b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.update_tag_value.js index b0381ff5f436..8bc38601371c 100644 --- a/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.update_tag_value.js +++ b/packages/google-cloud-resourcemanager/samples/generated/v3/tag_values.update_tag_value.js @@ -29,10 +29,10 @@ function main(tagValue) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The new definition of the TagValue. Only fields `description` and `etag` - * fields can be updated by this request. If the `etag` field is nonempty, it - * must match the `etag` field of the existing ControlGroup. Otherwise, - * `FAILED_PRECONDITION` will be returned. + * Required. The new definition of the TagValue. Only fields `description` and + * `etag` fields can be updated by this request. If the `etag` field is + * nonempty, it must match the `etag` field of the existing ControlGroup. + * Otherwise, `ABORTED` will be returned. */ // const tagValue = {} /** @@ -40,8 +40,8 @@ function main(tagValue) { */ // const updateMask = {} /** - * Optional. True to perform validations necessary for updating the resource, but not - * actually perform the action. + * Optional. True to perform validations necessary for updating the resource, + * but not actually perform the action. */ // const validateOnly = true diff --git a/packages/google-cloud-resourcemanager/src/index.ts b/packages/google-cloud-resourcemanager/src/index.ts index 1cd97dcedbfc..916f62a04397 100644 --- a/packages/google-cloud-resourcemanager/src/index.ts +++ b/packages/google-cloud-resourcemanager/src/index.ts @@ -26,6 +26,8 @@ const ProjectsClient = v3.ProjectsClient; type ProjectsClient = v3.ProjectsClient; const TagBindingsClient = v3.TagBindingsClient; type TagBindingsClient = v3.TagBindingsClient; +const TagHoldsClient = v3.TagHoldsClient; +type TagHoldsClient = v3.TagHoldsClient; const TagKeysClient = v3.TagKeysClient; type TagKeysClient = v3.TagKeysClient; const TagValuesClient = v3.TagValuesClient; @@ -37,6 +39,7 @@ export { OrganizationsClient, ProjectsClient, TagBindingsClient, + TagHoldsClient, TagKeysClient, TagValuesClient, }; @@ -46,6 +49,7 @@ export default { OrganizationsClient, ProjectsClient, TagBindingsClient, + TagHoldsClient, TagKeysClient, TagValuesClient, }; diff --git a/packages/google-cloud-resourcemanager/src/v3/folders_client.ts b/packages/google-cloud-resourcemanager/src/v3/folders_client.ts index d79f6d6928dc..6a1c66618996 100644 --- a/packages/google-cloud-resourcemanager/src/v3/folders_client.ts +++ b/packages/google-cloud-resourcemanager/src/v3/folders_client.ts @@ -193,6 +193,9 @@ export class FoldersClient { tagBindingPathTemplate: new this._gaxModule.PathTemplate( 'tagBindings/{tag_binding}' ), + tagHoldPathTemplate: new this._gaxModule.PathTemplate( + 'tagValues/{tag_value}/tagHolds/{tag_hold}' + ), tagKeyPathTemplate: new this._gaxModule.PathTemplate('tagKeys/{tag_key}'), tagValuePathTemplate: new this._gaxModule.PathTemplate( 'tagValues/{tag_value}' @@ -856,8 +859,8 @@ export class FoldersClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.resourcemanager.v3.Folder} request.folder - * Required. The folder being created, only the display name and parent will be - * consulted. All other fields will be ignored. + * Required. The folder being created, only the display name and parent will + * be consulted. All other fields will be 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. @@ -989,7 +992,9 @@ export class FoldersClient { * Updates a folder, changing its `display_name`. * Changes to the folder `display_name` will be rejected if they violate * either the `display_name` formatting rules or the naming constraints - * described in the {@link google.cloud.resourcemanager.v3.Folders.CreateFolder|CreateFolder} documentation. + * described in the + * {@link google.cloud.resourcemanager.v3.Folders.CreateFolder|CreateFolder} + * documentation. * * The folder's `display_name` must start and end with a letter or digit, * may contain letters, digits, spaces, hyphens and underscores and can be @@ -1005,8 +1010,8 @@ export class FoldersClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.resourcemanager.v3.Folder} request.folder - * Required. The new definition of the Folder. It must include the `name` field, which - * cannot be changed. + * Required. The new definition of the Folder. It must include the `name` + * field, which cannot be changed. * @param {google.protobuf.FieldMask} request.updateMask * Required. Fields to be updated. * Only the `display_name` can be updated. @@ -1156,9 +1161,9 @@ export class FoldersClient { * `FolderOperation` message as an aid to stateless clients. * Folder moves will be rejected if they violate either the naming, height, * or fanout constraints described in the - * {@link google.cloud.resourcemanager.v3.Folders.CreateFolder|CreateFolder} documentation. - * The caller must have `resourcemanager.folders.move` permission on the - * folder's current and proposed new parent. + * {@link google.cloud.resourcemanager.v3.Folders.CreateFolder|CreateFolder} + * documentation. The caller must have `resourcemanager.folders.move` + * permission on the folder's current and proposed new parent. * * @param {Object} request * The request object that will be sent. @@ -1166,9 +1171,9 @@ export class FoldersClient { * Required. The resource name of the Folder to move. * Must be of the form folders/{folder_id} * @param {string} request.destinationParent - * Required. The resource name of the folder or organization which should be the - * folder's new parent. - * Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. + * Required. The resource name of the folder or organization which should be + * the folder's new parent. Must be of the form `folders/{folder_id}` or + * `organizations/{org_id}`. * @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. @@ -1302,11 +1307,13 @@ export class FoldersClient { } /** * Requests deletion of a folder. The folder is moved into the - * {@link google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED|DELETE_REQUESTED} state - * immediately, and is deleted approximately 30 days later. This method may - * only be called on an empty folder, where a folder is empty if it doesn't - * contain any folders or projects in the {@link google.cloud.resourcemanager.v3.Folder.State.ACTIVE|ACTIVE} state. - * If called on a folder in {@link google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED|DELETE_REQUESTED} + * {@link google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED|DELETE_REQUESTED} + * state immediately, and is deleted approximately 30 days later. This method + * may only be called on an empty folder, where a folder is empty if it + * doesn't contain any folders or projects in the + * {@link google.cloud.resourcemanager.v3.Folder.State.ACTIVE|ACTIVE} state. If + * called on a folder in + * {@link google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED|DELETE_REQUESTED} * state the operation will result in a no-op success. * The caller must have `resourcemanager.folders.delete` permission on the * identified folder. @@ -1449,14 +1456,16 @@ export class FoldersClient { } /** * Cancels the deletion request for a folder. This method may be called on a - * folder in any state. If the folder is in the {@link google.cloud.resourcemanager.v3.Folder.State.ACTIVE|ACTIVE} - * state the result will be a no-op success. In order to succeed, the folder's - * parent must be in the {@link google.cloud.resourcemanager.v3.Folder.State.ACTIVE|ACTIVE} state. In addition, - * reintroducing the folder into the tree must not violate folder naming, - * height, and fanout constraints described in the - * {@link google.cloud.resourcemanager.v3.Folders.CreateFolder|CreateFolder} documentation. - * The caller must have `resourcemanager.folders.undelete` permission on the - * identified folder. + * folder in any state. If the folder is in the + * {@link google.cloud.resourcemanager.v3.Folder.State.ACTIVE|ACTIVE} state the + * result will be a no-op success. In order to succeed, the folder's parent + * must be in the + * {@link google.cloud.resourcemanager.v3.Folder.State.ACTIVE|ACTIVE} state. In + * addition, reintroducing the folder into the tree must not violate folder + * naming, height, and fanout constraints described in the + * {@link google.cloud.resourcemanager.v3.Folders.CreateFolder|CreateFolder} + * documentation. The caller must have `resourcemanager.folders.undelete` + * permission on the identified folder. * * @param {Object} request * The request object that will be sent. @@ -1606,14 +1615,19 @@ export class FoldersClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the organization or folder whose folders are - * being listed. - * Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. + * Required. The name of the parent resource whose folders are being listed. + * Only children of this parent resource are listed; descendants are not + * listed. + * + * If the parent is a folder, use the value `folders/{folder_id}`. If the + * parent is an organization, use the value `organizations/{org_id}`. + * * Access to this method is controlled by checking the * `resourcemanager.folders.list` permission on the `parent`. * @param {number} [request.pageSize] - * Optional. The maximum number of folders to return in the response. - * If unspecified, server picks an appropriate default. + * Optional. The maximum number of folders to return in the response. The + * server can return fewer folders than requested. If unspecified, server + * picks an appropriate default. * @param {string} [request.pageToken] * Optional. A pagination token returned from a previous call to `ListFolders` * that indicates where this listing should continue from. @@ -1710,14 +1724,19 @@ export class FoldersClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the organization or folder whose folders are - * being listed. - * Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. + * Required. The name of the parent resource whose folders are being listed. + * Only children of this parent resource are listed; descendants are not + * listed. + * + * If the parent is a folder, use the value `folders/{folder_id}`. If the + * parent is an organization, use the value `organizations/{org_id}`. + * * Access to this method is controlled by checking the * `resourcemanager.folders.list` permission on the `parent`. * @param {number} [request.pageSize] - * Optional. The maximum number of folders to return in the response. - * If unspecified, server picks an appropriate default. + * Optional. The maximum number of folders to return in the response. The + * server can return fewer folders than requested. If unspecified, server + * picks an appropriate default. * @param {string} [request.pageToken] * Optional. A pagination token returned from a previous call to `ListFolders` * that indicates where this listing should continue from. @@ -1762,14 +1781,19 @@ export class FoldersClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the organization or folder whose folders are - * being listed. - * Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. + * Required. The name of the parent resource whose folders are being listed. + * Only children of this parent resource are listed; descendants are not + * listed. + * + * If the parent is a folder, use the value `folders/{folder_id}`. If the + * parent is an organization, use the value `organizations/{org_id}`. + * * Access to this method is controlled by checking the * `resourcemanager.folders.list` permission on the `parent`. * @param {number} [request.pageSize] - * Optional. The maximum number of folders to return in the response. - * If unspecified, server picks an appropriate default. + * Optional. The maximum number of folders to return in the response. The + * server can return fewer folders than requested. If unspecified, server + * picks an appropriate default. * @param {string} [request.pageToken] * Optional. A pagination token returned from a previous call to `ListFolders` * that indicates where this listing should continue from. @@ -1818,11 +1842,12 @@ export class FoldersClient { * @param {Object} request * The request object that will be sent. * @param {number} [request.pageSize] - * Optional. The maximum number of folders to return in the response. - * If unspecified, server picks an appropriate default. + * Optional. The maximum number of folders to return in the response. The + * server can return fewer folders than requested. If unspecified, server + * picks an appropriate default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `SearchFolders` - * that indicates from where search should continue. + * Optional. A pagination token returned from a previous call to + * `SearchFolders` that indicates from where search should continue. * @param {string} [request.query] * Optional. Search criteria used to select the folders to return. * If no search criteria is specified then all accessible folders will be @@ -1944,11 +1969,12 @@ export class FoldersClient { * @param {Object} request * The request object that will be sent. * @param {number} [request.pageSize] - * Optional. The maximum number of folders to return in the response. - * If unspecified, server picks an appropriate default. + * Optional. The maximum number of folders to return in the response. The + * server can return fewer folders than requested. If unspecified, server + * picks an appropriate default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `SearchFolders` - * that indicates from where search should continue. + * Optional. A pagination token returned from a previous call to + * `SearchFolders` that indicates from where search should continue. * @param {string} [request.query] * Optional. Search criteria used to select the folders to return. * If no search criteria is specified then all accessible folders will be @@ -2018,11 +2044,12 @@ export class FoldersClient { * @param {Object} request * The request object that will be sent. * @param {number} [request.pageSize] - * Optional. The maximum number of folders to return in the response. - * If unspecified, server picks an appropriate default. + * Optional. The maximum number of folders to return in the response. The + * server can return fewer folders than requested. If unspecified, server + * picks an appropriate default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `SearchFolders` - * that indicates from where search should continue. + * Optional. A pagination token returned from a previous call to + * `SearchFolders` that indicates from where search should continue. * @param {string} [request.query] * Optional. Search criteria used to select the folders to return. * If no search criteria is specified then all accessible folders will be @@ -2085,6 +2112,181 @@ export class FoldersClient { callSettings ) as AsyncIterable; } + /** + * 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 -- // -------------------- @@ -2183,6 +2385,42 @@ export class FoldersClient { .tag_binding; } + /** + * Return a fully-qualified tagHold resource name string. + * + * @param {string} tag_value + * @param {string} tag_hold + * @returns {string} Resource name string. + */ + tagHoldPath(tagValue: string, tagHold: string) { + return this.pathTemplates.tagHoldPathTemplate.render({ + tag_value: tagValue, + tag_hold: tagHold, + }); + } + + /** + * Parse the tag_value from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_value. + */ + matchTagValueFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_value; + } + + /** + * Parse the tag_hold from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_hold. + */ + matchTagHoldFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_hold; + } + /** * Return a fully-qualified tagKey resource name string. * diff --git a/packages/google-cloud-resourcemanager/src/v3/folders_proto_list.json b/packages/google-cloud-resourcemanager/src/v3/folders_proto_list.json index 0c0066033c06..639794aadd4b 100644 --- a/packages/google-cloud-resourcemanager/src/v3/folders_proto_list.json +++ b/packages/google-cloud-resourcemanager/src/v3/folders_proto_list.json @@ -3,6 +3,7 @@ "../../protos/google/cloud/resourcemanager/v3/organizations.proto", "../../protos/google/cloud/resourcemanager/v3/projects.proto", "../../protos/google/cloud/resourcemanager/v3/tag_bindings.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_holds.proto", "../../protos/google/cloud/resourcemanager/v3/tag_keys.proto", "../../protos/google/cloud/resourcemanager/v3/tag_values.proto" ] diff --git a/packages/google-cloud-resourcemanager/src/v3/gapic_metadata.json b/packages/google-cloud-resourcemanager/src/v3/gapic_metadata.json index 066fbe71144b..c68b1fa08e03 100644 --- a/packages/google-cloud-resourcemanager/src/v3/gapic_metadata.json +++ b/packages/google-cloud-resourcemanager/src/v3/gapic_metadata.json @@ -358,6 +358,13 @@ "listTagBindingsStream", "listTagBindingsAsync" ] + }, + "ListEffectiveTags": { + "methods": [ + "listEffectiveTags", + "listEffectiveTagsStream", + "listEffectiveTagsAsync" + ] } } }, @@ -380,6 +387,61 @@ "listTagBindingsStream", "listTagBindingsAsync" ] + }, + "ListEffectiveTags": { + "methods": [ + "listEffectiveTags", + "listEffectiveTagsStream", + "listEffectiveTagsAsync" + ] + } + } + } + } + }, + "TagHolds": { + "clients": { + "grpc": { + "libraryClient": "TagHoldsClient", + "rpcs": { + "CreateTagHold": { + "methods": [ + "createTagHold" + ] + }, + "DeleteTagHold": { + "methods": [ + "deleteTagHold" + ] + }, + "ListTagHolds": { + "methods": [ + "listTagHolds", + "listTagHoldsStream", + "listTagHoldsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TagHoldsClient", + "rpcs": { + "CreateTagHold": { + "methods": [ + "createTagHold" + ] + }, + "DeleteTagHold": { + "methods": [ + "deleteTagHold" + ] + }, + "ListTagHolds": { + "methods": [ + "listTagHolds", + "listTagHoldsStream", + "listTagHoldsAsync" + ] } } } @@ -395,6 +457,11 @@ "getTagKey" ] }, + "GetNamespacedTagKey": { + "methods": [ + "getNamespacedTagKey" + ] + }, "GetIamPolicy": { "methods": [ "getIamPolicy" @@ -442,6 +509,11 @@ "getTagKey" ] }, + "GetNamespacedTagKey": { + "methods": [ + "getNamespacedTagKey" + ] + }, "GetIamPolicy": { "methods": [ "getIamPolicy" @@ -493,6 +565,11 @@ "getTagValue" ] }, + "GetNamespacedTagValue": { + "methods": [ + "getNamespacedTagValue" + ] + }, "GetIamPolicy": { "methods": [ "getIamPolicy" @@ -540,6 +617,11 @@ "getTagValue" ] }, + "GetNamespacedTagValue": { + "methods": [ + "getNamespacedTagValue" + ] + }, "GetIamPolicy": { "methods": [ "getIamPolicy" diff --git a/packages/google-cloud-resourcemanager/src/v3/index.ts b/packages/google-cloud-resourcemanager/src/v3/index.ts index 7eab65b2174b..a6fde0648860 100644 --- a/packages/google-cloud-resourcemanager/src/v3/index.ts +++ b/packages/google-cloud-resourcemanager/src/v3/index.ts @@ -20,5 +20,6 @@ export {FoldersClient} from './folders_client'; export {OrganizationsClient} from './organizations_client'; export {ProjectsClient} from './projects_client'; export {TagBindingsClient} from './tag_bindings_client'; +export {TagHoldsClient} from './tag_holds_client'; export {TagKeysClient} from './tag_keys_client'; export {TagValuesClient} from './tag_values_client'; diff --git a/packages/google-cloud-resourcemanager/src/v3/organizations_client.ts b/packages/google-cloud-resourcemanager/src/v3/organizations_client.ts index bd6c54cef135..bbd5dd1b185b 100644 --- a/packages/google-cloud-resourcemanager/src/v3/organizations_client.ts +++ b/packages/google-cloud-resourcemanager/src/v3/organizations_client.ts @@ -188,6 +188,9 @@ export class OrganizationsClient { tagBindingPathTemplate: new this._gaxModule.PathTemplate( 'tagBindings/{tag_binding}' ), + tagHoldPathTemplate: new this._gaxModule.PathTemplate( + 'tagValues/{tag_value}/tagHolds/{tag_hold}' + ), tagKeyPathTemplate: new this._gaxModule.PathTemplate('tagKeys/{tag_key}'), tagValuePathTemplate: new this._gaxModule.PathTemplate( 'tagValues/{tag_value}' @@ -352,9 +355,9 @@ export class OrganizationsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The resource name of the Organization to fetch. This is the organization's - * relative path in the API, formatted as "organizations/[organizationId]". - * For example, "organizations/1234". + * Required. The resource name of the Organization to fetch. This is the + * organization's relative path in the API, formatted as + * "organizations/[organizationId]". For example, "organizations/1234". * @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. @@ -744,13 +747,15 @@ export class OrganizationsClient { * The request object that will be sent. * @param {number} [request.pageSize] * Optional. The maximum number of organizations to return in the response. - * If unspecified, server picks an appropriate default. + * The server can return fewer organizations than requested. If unspecified, + * server picks an appropriate default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `SearchOrganizations` - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * `SearchOrganizations` that indicates from where listing should continue. * @param {string} [request.query] - * Optional. An optional query string used to filter the Organizations to return in - * the response. Query rules are case-insensitive. + * Optional. An optional query string used to filter the Organizations to + * return in the response. Query rules are case-insensitive. + * * * ``` * | Field | Description | @@ -857,13 +862,15 @@ export class OrganizationsClient { * The request object that will be sent. * @param {number} [request.pageSize] * Optional. The maximum number of organizations to return in the response. - * If unspecified, server picks an appropriate default. + * The server can return fewer organizations than requested. If unspecified, + * server picks an appropriate default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `SearchOrganizations` - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * `SearchOrganizations` that indicates from where listing should continue. * @param {string} [request.query] - * Optional. An optional query string used to filter the Organizations to return in - * the response. Query rules are case-insensitive. + * Optional. An optional query string used to filter the Organizations to + * return in the response. Query rules are case-insensitive. + * * * ``` * | Field | Description | @@ -918,13 +925,15 @@ export class OrganizationsClient { * The request object that will be sent. * @param {number} [request.pageSize] * Optional. The maximum number of organizations to return in the response. - * If unspecified, server picks an appropriate default. + * The server can return fewer organizations than requested. If unspecified, + * server picks an appropriate default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `SearchOrganizations` - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * `SearchOrganizations` that indicates from where listing should continue. * @param {string} [request.query] - * Optional. An optional query string used to filter the Organizations to return in - * the response. Query rules are case-insensitive. + * Optional. An optional query string used to filter the Organizations to + * return in the response. Query rules are case-insensitive. + * * * ``` * | Field | Description | @@ -1069,6 +1078,42 @@ export class OrganizationsClient { .tag_binding; } + /** + * Return a fully-qualified tagHold resource name string. + * + * @param {string} tag_value + * @param {string} tag_hold + * @returns {string} Resource name string. + */ + tagHoldPath(tagValue: string, tagHold: string) { + return this.pathTemplates.tagHoldPathTemplate.render({ + tag_value: tagValue, + tag_hold: tagHold, + }); + } + + /** + * Parse the tag_value from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_value. + */ + matchTagValueFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_value; + } + + /** + * Parse the tag_hold from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_hold. + */ + matchTagHoldFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_hold; + } + /** * Return a fully-qualified tagKey resource name string. * diff --git a/packages/google-cloud-resourcemanager/src/v3/organizations_proto_list.json b/packages/google-cloud-resourcemanager/src/v3/organizations_proto_list.json index 0c0066033c06..639794aadd4b 100644 --- a/packages/google-cloud-resourcemanager/src/v3/organizations_proto_list.json +++ b/packages/google-cloud-resourcemanager/src/v3/organizations_proto_list.json @@ -3,6 +3,7 @@ "../../protos/google/cloud/resourcemanager/v3/organizations.proto", "../../protos/google/cloud/resourcemanager/v3/projects.proto", "../../protos/google/cloud/resourcemanager/v3/tag_bindings.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_holds.proto", "../../protos/google/cloud/resourcemanager/v3/tag_keys.proto", "../../protos/google/cloud/resourcemanager/v3/tag_values.proto" ] diff --git a/packages/google-cloud-resourcemanager/src/v3/projects_client.ts b/packages/google-cloud-resourcemanager/src/v3/projects_client.ts index 7a523088052a..415832c4a836 100644 --- a/packages/google-cloud-resourcemanager/src/v3/projects_client.ts +++ b/packages/google-cloud-resourcemanager/src/v3/projects_client.ts @@ -191,6 +191,9 @@ export class ProjectsClient { tagBindingPathTemplate: new this._gaxModule.PathTemplate( 'tagBindings/{tag_binding}' ), + tagHoldPathTemplate: new this._gaxModule.PathTemplate( + 'tagValues/{tag_value}/tagHolds/{tag_hold}' + ), tagKeyPathTemplate: new this._gaxModule.PathTemplate('tagKeys/{tag_key}'), tagValuePathTemplate: new this._gaxModule.PathTemplate( 'tagValues/{tag_value}' @@ -538,7 +541,8 @@ export class ProjectsClient { return this.innerApiCalls.getProject(request, options, callback); } /** - * Returns the IAM access control policy for the specified project. + * Returns the IAM access control policy for the specified project, in the + * format `projects/{ProjectIdOrNumber}` e.g. projects/123. * Permission is denied if the policy or the resource do not exist. * * @param {Object} request @@ -626,7 +630,8 @@ export class ProjectsClient { return this.innerApiCalls.getIamPolicy(request, options, callback); } /** - * Sets the IAM access control policy for the specified project. + * Sets the IAM access control policy for the specified project, in the + * format `projects/{ProjectIdOrNumber}` e.g. projects/123. * * CAUTION: This method will replace the existing policy, and cannot be used * to append additional IAM settings. @@ -658,18 +663,14 @@ export class ProjectsClient { * `setIamPolicy()`; * they must be sent only using the Cloud Platform Console. * - * + Membership changes that leave the project without any owners that have - * accepted the Terms of Service (ToS) will be rejected. - * * + If the project is not part of an organization, there must be at least * one owner who has accepted the Terms of Service (ToS) agreement in the * policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner * from the policy will fail. This restriction also applies to legacy * projects that no longer have owners who have accepted the ToS. Edits to * IAM policies will be rejected until the lack of a ToS-accepting owner is - * rectified. - * - * + Calling this method requires enabling the App Engine Admin API. + * rectified. If the project is part of an organization, you can remove all + * owners, potentially making the organization inaccessible. * * @param {Object} request * The request object that will be sent. @@ -764,7 +765,8 @@ export class ProjectsClient { return this.innerApiCalls.setIamPolicy(request, options, callback); } /** - * Returns permissions that a caller has on the specified project. + * Returns permissions that a caller has on the specified project, in the + * format `projects/{ProjectIdOrNumber}` e.g. projects/123.. * * @param {Object} request * The request object that will be sent. @@ -870,7 +872,7 @@ export class ProjectsClient { * * If the `parent` field is set, the `resourcemanager.projects.create` * permission is checked on the parent resource. If no parent is set and - * the authorization credentials belong to an Organziation, the parent + * the authorization credentials belong to an Organization, the parent * will be set to that Organization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1153,9 +1155,12 @@ export class ProjectsClient { * Upon success, the `Operation.response` field will be populated with the * moved project. * - * The caller must have `resourcemanager.projects.update` permission on the - * project and have `resourcemanager.projects.move` permission on the - * project's current and proposed new parent. + * The caller must have `resourcemanager.projects.move` permission on the + * project, on the project's current and proposed new parent. + * + * If project has no current parent, or it currently does not have an + * associated organization resource, you will also need the + * `resourcemanager.projects.setIamPolicy` permission in the project. * * * @@ -1305,7 +1310,8 @@ export class ProjectsClient { * * This method changes the Project's lifecycle state from * {@link google.cloud.resourcemanager.v3.Project.State.ACTIVE|ACTIVE} - * to {@link google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED|DELETE_REQUESTED}. + * to + * {@link google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED|DELETE_REQUESTED}. * The deletion starts at an unspecified time, * at which point the Project is no longer accessible. * @@ -1624,21 +1630,23 @@ export class ProjectsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The name of the parent resource to list projects under. + * Required. The name of the parent resource whose projects are being listed. + * Only children of this parent resource are listed; descendants are not + * listed. * - * For example, setting this field to 'folders/1234' would list all projects - * directly under that folder. + * If the parent is a folder, use the value `folders/{folder_id}`. If the + * parent is an organization, use the value `organizations/{org_id}`. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to [ListProjects] - * [google.cloud.resourcemanager.v3.Projects.ListProjects] - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that + * indicates from where listing should continue. * @param {number} [request.pageSize] * Optional. The maximum number of projects to return in the response. * The server can return fewer projects than requested. * If unspecified, server picks an appropriate default. * @param {boolean} [request.showDeleted] - * Optional. Indicate that projects in the `DELETE_REQUESTED` state should also be - * returned. Normally only `ACTIVE` projects are returned. + * Optional. Indicate that projects in the `DELETE_REQUESTED` state should + * also be returned. Normally only `ACTIVE` projects are returned. * @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. @@ -1728,21 +1736,23 @@ export class ProjectsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The name of the parent resource to list projects under. + * Required. The name of the parent resource whose projects are being listed. + * Only children of this parent resource are listed; descendants are not + * listed. * - * For example, setting this field to 'folders/1234' would list all projects - * directly under that folder. + * If the parent is a folder, use the value `folders/{folder_id}`. If the + * parent is an organization, use the value `organizations/{org_id}`. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to [ListProjects] - * [google.cloud.resourcemanager.v3.Projects.ListProjects] - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that + * indicates from where listing should continue. * @param {number} [request.pageSize] * Optional. The maximum number of projects to return in the response. * The server can return fewer projects than requested. * If unspecified, server picks an appropriate default. * @param {boolean} [request.showDeleted] - * Optional. Indicate that projects in the `DELETE_REQUESTED` state should also be - * returned. Normally only `ACTIVE` projects are returned. + * Optional. Indicate that projects in the `DELETE_REQUESTED` state should + * also be returned. Normally only `ACTIVE` projects are returned. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -1780,21 +1790,23 @@ export class ProjectsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The name of the parent resource to list projects under. + * Required. The name of the parent resource whose projects are being listed. + * Only children of this parent resource are listed; descendants are not + * listed. * - * For example, setting this field to 'folders/1234' would list all projects - * directly under that folder. + * If the parent is a folder, use the value `folders/{folder_id}`. If the + * parent is an organization, use the value `organizations/{org_id}`. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to [ListProjects] - * [google.cloud.resourcemanager.v3.Projects.ListProjects] - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that + * indicates from where listing should continue. * @param {number} [request.pageSize] * Optional. The maximum number of projects to return in the response. * The server can return fewer projects than requested. * If unspecified, server picks an appropriate default. * @param {boolean} [request.showDeleted] - * Optional. Indicate that projects in the `DELETE_REQUESTED` state should also be - * returned. Normally only `ACTIVE` projects are returned. + * Optional. Indicate that projects in the `DELETE_REQUESTED` state should + * also be returned. Normally only `ACTIVE` projects are returned. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -1842,22 +1854,22 @@ export class ProjectsClient { * @param {string} [request.query] * Optional. A query string for searching for projects that the caller has * `resourcemanager.projects.get` permission to. If multiple fields are - * included in the query, the it will return results that match any of the + * included in the query, then it will return results that match any of the * fields. Some eligible fields are: * * ``` * | Field | Description | * |-------------------------|----------------------------------------------| * | displayName, name | Filters by displayName. | - * | parent | Project's parent. (for example: folders/123, - * organizations/*) Prefer parent field over parent.type and parent.id. | - * | parent.type | Parent's type: `folder` or `organization`. | - * | parent.id | Parent's id number (for example: 123) | - * | id, projectId | Filters by projectId. | - * | state, lifecycleState | Filters by state. | - * | labels | Filters by label name or value. | - * | labels. (where *key* is the name of a label) | Filters by label - * name. | + * | parent | Project's parent (for example: folders/123, + * organizations/*). Prefer parent field over parent.type and parent.id.| | + * parent.type | Parent's type: `folder` or `organization`. | | + * parent.id | Parent's id number (for example: 123) | | + * id, projectId | Filters by projectId. | | + * state, lifecycleState | Filters by state. | | + * labels | Filters by label name or value. | | + * labels.\ (where *key* is the name of a label) | Filters by label + * name.| * ``` * * Search expressions are case insensitive. @@ -1873,16 +1885,16 @@ export class ProjectsClient { * | NAME:howl | Equivalent to above. | * | labels.color:* | The project has the label `color`. | * | labels.color:red | The project's label `color` has the value `red`. | - * | labels.color:red labels.size:big | The project's label `color` has - * the value `red` and its label `size` has the value `big`. | + * | labels.color:red labels.size:big | The project's label `color` has the + * value `red` or its label `size` has the value `big`. | * ``` * * If no query is specified, the call will return projects for which the user * has the `resourcemanager.projects.get` permission. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to [ListProjects] - * [google.cloud.resourcemanager.v3.Projects.ListProjects] - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that + * indicates from where listing should continue. * @param {number} [request.pageSize] * Optional. The maximum number of projects to return in the response. * The server can return fewer projects than requested. @@ -1978,22 +1990,22 @@ export class ProjectsClient { * @param {string} [request.query] * Optional. A query string for searching for projects that the caller has * `resourcemanager.projects.get` permission to. If multiple fields are - * included in the query, the it will return results that match any of the + * included in the query, then it will return results that match any of the * fields. Some eligible fields are: * * ``` * | Field | Description | * |-------------------------|----------------------------------------------| * | displayName, name | Filters by displayName. | - * | parent | Project's parent. (for example: folders/123, - * organizations/*) Prefer parent field over parent.type and parent.id. | - * | parent.type | Parent's type: `folder` or `organization`. | - * | parent.id | Parent's id number (for example: 123) | - * | id, projectId | Filters by projectId. | - * | state, lifecycleState | Filters by state. | - * | labels | Filters by label name or value. | - * | labels. (where *key* is the name of a label) | Filters by label - * name. | + * | parent | Project's parent (for example: folders/123, + * organizations/*). Prefer parent field over parent.type and parent.id.| | + * parent.type | Parent's type: `folder` or `organization`. | | + * parent.id | Parent's id number (for example: 123) | | + * id, projectId | Filters by projectId. | | + * state, lifecycleState | Filters by state. | | + * labels | Filters by label name or value. | | + * labels.\ (where *key* is the name of a label) | Filters by label + * name.| * ``` * * Search expressions are case insensitive. @@ -2009,16 +2021,16 @@ export class ProjectsClient { * | NAME:howl | Equivalent to above. | * | labels.color:* | The project has the label `color`. | * | labels.color:red | The project's label `color` has the value `red`. | - * | labels.color:red labels.size:big | The project's label `color` has - * the value `red` and its label `size` has the value `big`. | + * | labels.color:red labels.size:big | The project's label `color` has the + * value `red` or its label `size` has the value `big`. | * ``` * * If no query is specified, the call will return projects for which the user * has the `resourcemanager.projects.get` permission. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to [ListProjects] - * [google.cloud.resourcemanager.v3.Projects.ListProjects] - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that + * indicates from where listing should continue. * @param {number} [request.pageSize] * Optional. The maximum number of projects to return in the response. * The server can return fewer projects than requested. @@ -2062,22 +2074,22 @@ export class ProjectsClient { * @param {string} [request.query] * Optional. A query string for searching for projects that the caller has * `resourcemanager.projects.get` permission to. If multiple fields are - * included in the query, the it will return results that match any of the + * included in the query, then it will return results that match any of the * fields. Some eligible fields are: * * ``` * | Field | Description | * |-------------------------|----------------------------------------------| * | displayName, name | Filters by displayName. | - * | parent | Project's parent. (for example: folders/123, - * organizations/*) Prefer parent field over parent.type and parent.id. | - * | parent.type | Parent's type: `folder` or `organization`. | - * | parent.id | Parent's id number (for example: 123) | - * | id, projectId | Filters by projectId. | - * | state, lifecycleState | Filters by state. | - * | labels | Filters by label name or value. | - * | labels. (where *key* is the name of a label) | Filters by label - * name. | + * | parent | Project's parent (for example: folders/123, + * organizations/*). Prefer parent field over parent.type and parent.id.| | + * parent.type | Parent's type: `folder` or `organization`. | | + * parent.id | Parent's id number (for example: 123) | | + * id, projectId | Filters by projectId. | | + * state, lifecycleState | Filters by state. | | + * labels | Filters by label name or value. | | + * labels.\ (where *key* is the name of a label) | Filters by label + * name.| * ``` * * Search expressions are case insensitive. @@ -2093,16 +2105,16 @@ export class ProjectsClient { * | NAME:howl | Equivalent to above. | * | labels.color:* | The project has the label `color`. | * | labels.color:red | The project's label `color` has the value `red`. | - * | labels.color:red labels.size:big | The project's label `color` has - * the value `red` and its label `size` has the value `big`. | + * | labels.color:red labels.size:big | The project's label `color` has the + * value `red` or its label `size` has the value `big`. | * ``` * * If no query is specified, the call will return projects for which the user * has the `resourcemanager.projects.get` permission. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to [ListProjects] - * [google.cloud.resourcemanager.v3.Projects.ListProjects] - * that indicates from where listing should continue. + * Optional. A pagination token returned from a previous call to + * [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that + * indicates from where listing should continue. * @param {number} [request.pageSize] * Optional. The maximum number of projects to return in the response. * The server can return fewer projects than requested. @@ -2137,6 +2149,181 @@ export class ProjectsClient { callSettings ) as AsyncIterable; } + /** + * 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 -- // -------------------- @@ -2235,6 +2422,42 @@ export class ProjectsClient { .tag_binding; } + /** + * Return a fully-qualified tagHold resource name string. + * + * @param {string} tag_value + * @param {string} tag_hold + * @returns {string} Resource name string. + */ + tagHoldPath(tagValue: string, tagHold: string) { + return this.pathTemplates.tagHoldPathTemplate.render({ + tag_value: tagValue, + tag_hold: tagHold, + }); + } + + /** + * Parse the tag_value from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_value. + */ + matchTagValueFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_value; + } + + /** + * Parse the tag_hold from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_hold. + */ + matchTagHoldFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_hold; + } + /** * Return a fully-qualified tagKey resource name string. * diff --git a/packages/google-cloud-resourcemanager/src/v3/projects_proto_list.json b/packages/google-cloud-resourcemanager/src/v3/projects_proto_list.json index 0c0066033c06..639794aadd4b 100644 --- a/packages/google-cloud-resourcemanager/src/v3/projects_proto_list.json +++ b/packages/google-cloud-resourcemanager/src/v3/projects_proto_list.json @@ -3,6 +3,7 @@ "../../protos/google/cloud/resourcemanager/v3/organizations.proto", "../../protos/google/cloud/resourcemanager/v3/projects.proto", "../../protos/google/cloud/resourcemanager/v3/tag_bindings.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_holds.proto", "../../protos/google/cloud/resourcemanager/v3/tag_keys.proto", "../../protos/google/cloud/resourcemanager/v3/tag_values.proto" ] diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_bindings_client.ts b/packages/google-cloud-resourcemanager/src/v3/tag_bindings_client.ts index d64ddc581ae4..63fdcae175b4 100644 --- a/packages/google-cloud-resourcemanager/src/v3/tag_bindings_client.ts +++ b/packages/google-cloud-resourcemanager/src/v3/tag_bindings_client.ts @@ -41,7 +41,7 @@ const version = require('../../../package.json').version; /** * Allow users to create and manage TagBindings between TagValues and - * different cloud resources throughout the GCP resource hierarchy. + * different Google Cloud resources throughout the GCP resource hierarchy. * @class * @memberof v3 */ @@ -192,6 +192,9 @@ export class TagBindingsClient { tagBindingPathTemplate: new this._gaxModule.PathTemplate( 'tagBindings/{tag_binding}' ), + tagHoldPathTemplate: new this._gaxModule.PathTemplate( + 'tagValues/{tag_value}/tagHolds/{tag_hold}' + ), tagKeyPathTemplate: new this._gaxModule.PathTemplate('tagKeys/{tag_key}'), tagValuePathTemplate: new this._gaxModule.PathTemplate( 'tagValues/{tag_value}' @@ -207,6 +210,11 @@ export class TagBindingsClient { 'nextPageToken', 'tagBindings' ), + listEffectiveTags: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'effectiveTags' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -308,6 +316,7 @@ export class TagBindingsClient { 'listTagBindings', 'createTagBinding', 'deleteTagBinding', + 'listEffectiveTags', ]; for (const methodName of tagBindingsStubMethods) { const callPromise = this.tagBindingsStub.then( @@ -399,16 +408,15 @@ export class TagBindingsClient { // ------------------- /** - * Creates a TagBinding between a TagValue and a cloud resource - * (currently project, folder, or organization). + * Creates a TagBinding between a TagValue and a Google Cloud resource. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.resourcemanager.v3.TagBinding} request.tagBinding * Required. The TagBinding to be created. * @param {boolean} [request.validateOnly] - * Optional. Set to true to perform the validations necessary for creating the resource, - * but not actually perform the action. + * Optional. Set to true to perform the validations necessary for creating the + * resource, but not actually perform the action. * @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. @@ -677,8 +685,8 @@ export class TagBindingsClient { >; } /** - * Lists the TagBindings for the given cloud resource, as specified with - * `parent`. + * Lists the TagBindings for the given Google Cloud resource, as specified + * with `parent`. * * NOTE: The `parent` field is expected to be a full resource name: * https://cloud.google.com/apis/design/resource_names#full_resource_name @@ -686,16 +694,16 @@ export class TagBindingsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The full resource name of a resource for which you want to list existing - * TagBindings. - * E.g. "//cloudresourcemanager.googleapis.com/projects/123" + * Required. The full resource name of a resource for which you want to list + * existing TagBindings. E.g. + * "//cloudresourcemanager.googleapis.com/projects/123" * @param {number} [request.pageSize] - * Optional. The maximum number of TagBindings to return in the response. The server - * allows a maximum of 300 TagBindings to return. If unspecified, the server - * will use 100 as the default. + * Optional. The maximum number of TagBindings to return in the response. The + * server allows a maximum of 300 TagBindings to return. If unspecified, the + * server will use 100 as the default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `ListTagBindings` - * that indicates where this listing should continue from. + * Optional. A pagination token returned from a previous call to + * `ListTagBindings` that indicates where this listing should continue from. * @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. @@ -785,16 +793,16 @@ export class TagBindingsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The full resource name of a resource for which you want to list existing - * TagBindings. - * E.g. "//cloudresourcemanager.googleapis.com/projects/123" + * Required. The full resource name of a resource for which you want to list + * existing TagBindings. E.g. + * "//cloudresourcemanager.googleapis.com/projects/123" * @param {number} [request.pageSize] - * Optional. The maximum number of TagBindings to return in the response. The server - * allows a maximum of 300 TagBindings to return. If unspecified, the server - * will use 100 as the default. + * Optional. The maximum number of TagBindings to return in the response. The + * server allows a maximum of 300 TagBindings to return. If unspecified, the + * server will use 100 as the default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `ListTagBindings` - * that indicates where this listing should continue from. + * Optional. A pagination token returned from a previous call to + * `ListTagBindings` that indicates where this listing should continue from. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -832,16 +840,16 @@ export class TagBindingsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The full resource name of a resource for which you want to list existing - * TagBindings. - * E.g. "//cloudresourcemanager.googleapis.com/projects/123" + * Required. The full resource name of a resource for which you want to list + * existing TagBindings. E.g. + * "//cloudresourcemanager.googleapis.com/projects/123" * @param {number} [request.pageSize] - * Optional. The maximum number of TagBindings to return in the response. The server - * allows a maximum of 300 TagBindings to return. If unspecified, the server - * will use 100 as the default. + * Optional. The maximum number of TagBindings to return in the response. The + * server allows a maximum of 300 TagBindings to return. If unspecified, the + * server will use 100 as the default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `ListTagBindings` - * that indicates where this listing should continue from. + * Optional. A pagination token returned from a previous call to + * `ListTagBindings` that indicates where this listing should continue from. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -872,6 +880,374 @@ export class TagBindingsClient { callSettings ) as AsyncIterable; } + /** + * Return a list of effective tags for the given Google Cloud resource, as + * specified in `parent`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The full resource name of a resource for which you want to list + * the effective tags. E.g. + * "//cloudresourcemanager.googleapis.com/projects/123" + * @param {number} [request.pageSize] + * Optional. The maximum number of effective tags to return in the response. + * The server allows a maximum of 300 effective tags to return in a single + * page. If unspecified, the server will use 100 as the default. + * @param {string} [request.pageToken] + * Optional. A pagination token returned from a previous call to + * `ListEffectiveTags` that indicates from where this listing should continue. + * @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 {@link google.cloud.resourcemanager.v3.EffectiveTag | EffectiveTag}. + * 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 `listEffectiveTagsAsync()` + * 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. + */ + listEffectiveTags( + request?: protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.resourcemanager.v3.IEffectiveTag[], + protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest | null, + protos.google.cloud.resourcemanager.v3.IListEffectiveTagsResponse + ] + >; + listEffectiveTags( + request: protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + | protos.google.cloud.resourcemanager.v3.IListEffectiveTagsResponse + | null + | undefined, + protos.google.cloud.resourcemanager.v3.IEffectiveTag + > + ): void; + listEffectiveTags( + request: protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + callback: PaginationCallback< + protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + | protos.google.cloud.resourcemanager.v3.IListEffectiveTagsResponse + | null + | undefined, + protos.google.cloud.resourcemanager.v3.IEffectiveTag + > + ): void; + listEffectiveTags( + request?: protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + | protos.google.cloud.resourcemanager.v3.IListEffectiveTagsResponse + | null + | undefined, + protos.google.cloud.resourcemanager.v3.IEffectiveTag + >, + callback?: PaginationCallback< + protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + | protos.google.cloud.resourcemanager.v3.IListEffectiveTagsResponse + | null + | undefined, + protos.google.cloud.resourcemanager.v3.IEffectiveTag + > + ): Promise< + [ + protos.google.cloud.resourcemanager.v3.IEffectiveTag[], + protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest | null, + protos.google.cloud.resourcemanager.v3.IListEffectiveTagsResponse + ] + > | 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 || {}; + this.initialize(); + return this.innerApiCalls.listEffectiveTags(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 full resource name of a resource for which you want to list + * the effective tags. E.g. + * "//cloudresourcemanager.googleapis.com/projects/123" + * @param {number} [request.pageSize] + * Optional. The maximum number of effective tags to return in the response. + * The server allows a maximum of 300 effective tags to return in a single + * page. If unspecified, the server will use 100 as the default. + * @param {string} [request.pageToken] + * Optional. A pagination token returned from a previous call to + * `ListEffectiveTags` that indicates from where this listing should continue. + * @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 {@link google.cloud.resourcemanager.v3.EffectiveTag | EffectiveTag} 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 `listEffectiveTagsAsync()` + * 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. + */ + listEffectiveTagsStream( + request?: protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listEffectiveTags']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEffectiveTags.createStream( + this.innerApiCalls.listEffectiveTags as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listEffectiveTags`, 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 full resource name of a resource for which you want to list + * the effective tags. E.g. + * "//cloudresourcemanager.googleapis.com/projects/123" + * @param {number} [request.pageSize] + * Optional. The maximum number of effective tags to return in the response. + * The server allows a maximum of 300 effective tags to return in a single + * page. If unspecified, the server will use 100 as the default. + * @param {string} [request.pageToken] + * Optional. A pagination token returned from a previous call to + * `ListEffectiveTags` that indicates from where this listing should continue. + * @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 + * {@link google.cloud.resourcemanager.v3.EffectiveTag | EffectiveTag}. 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/v3/tag_bindings.list_effective_tags.js + * region_tag:cloudresourcemanager_v3_generated_TagBindings_ListEffectiveTags_async + */ + listEffectiveTagsAsync( + request?: protos.google.cloud.resourcemanager.v3.IListEffectiveTagsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listEffectiveTags']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEffectiveTags.asyncIterate( + this.innerApiCalls['listEffectiveTags'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 -- // -------------------- @@ -970,6 +1346,42 @@ export class TagBindingsClient { .tag_binding; } + /** + * Return a fully-qualified tagHold resource name string. + * + * @param {string} tag_value + * @param {string} tag_hold + * @returns {string} Resource name string. + */ + tagHoldPath(tagValue: string, tagHold: string) { + return this.pathTemplates.tagHoldPathTemplate.render({ + tag_value: tagValue, + tag_hold: tagHold, + }); + } + + /** + * Parse the tag_value from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_value. + */ + matchTagValueFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_value; + } + + /** + * Parse the tag_hold from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_hold. + */ + matchTagHoldFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_hold; + } + /** * Return a fully-qualified tagKey resource name string. * diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_bindings_client_config.json b/packages/google-cloud-resourcemanager/src/v3/tag_bindings_client_config.json index 25129f4ee675..5a1182f0c9e7 100644 --- a/packages/google-cloud-resourcemanager/src/v3/tag_bindings_client_config.json +++ b/packages/google-cloud-resourcemanager/src/v3/tag_bindings_client_config.json @@ -37,6 +37,10 @@ "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" + }, + "ListEffectiveTags": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_bindings_proto_list.json b/packages/google-cloud-resourcemanager/src/v3/tag_bindings_proto_list.json index 0c0066033c06..639794aadd4b 100644 --- a/packages/google-cloud-resourcemanager/src/v3/tag_bindings_proto_list.json +++ b/packages/google-cloud-resourcemanager/src/v3/tag_bindings_proto_list.json @@ -3,6 +3,7 @@ "../../protos/google/cloud/resourcemanager/v3/organizations.proto", "../../protos/google/cloud/resourcemanager/v3/projects.proto", "../../protos/google/cloud/resourcemanager/v3/tag_bindings.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_holds.proto", "../../protos/google/cloud/resourcemanager/v3/tag_keys.proto", "../../protos/google/cloud/resourcemanager/v3/tag_values.proto" ] diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_holds_client.ts b/packages/google-cloud-resourcemanager/src/v3/tag_holds_client.ts new file mode 100644 index 000000000000..bfa1a7094682 --- /dev/null +++ b/packages/google-cloud-resourcemanager/src/v3/tag_holds_client.ts @@ -0,0 +1,1303 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v3/tag_holds_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './tag_holds_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Allow users to create and manage TagHolds for TagValues. TagHolds represent + * the use of a Tag Value that is not captured by TagBindings but + * should still block TagValue deletion (such as a reference in a policy + * condition). This service provides isolated failure domains by cloud location + * so that TagHolds can be managed in the same location as their usage. + * @class + * @memberof v3 + */ +export class TagHoldsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + tagHoldsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TagHoldsClient. + * + * @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/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @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}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new TagHoldsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof TagHoldsClient; + 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'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}'), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + tagBindingPathTemplate: new this._gaxModule.PathTemplate( + 'tagBindings/{tag_binding}' + ), + tagHoldPathTemplate: new this._gaxModule.PathTemplate( + 'tagValues/{tag_value}/tagHolds/{tag_hold}' + ), + tagKeyPathTemplate: new this._gaxModule.PathTemplate('tagKeys/{tag_key}'), + tagValuePathTemplate: new this._gaxModule.PathTemplate( + 'tagValues/{tag_value}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listTagHolds: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'tagHolds' + ), + }; + + 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. + 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.longrunning.Operations.GetOperation', + get: '/v3/{name=operations/**}', + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createTagHoldResponse = protoFilesRoot.lookup( + '.google.cloud.resourcemanager.v3.TagHold' + ) as gax.protobuf.Type; + const createTagHoldMetadata = protoFilesRoot.lookup( + '.google.cloud.resourcemanager.v3.CreateTagHoldMetadata' + ) as gax.protobuf.Type; + const deleteTagHoldResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteTagHoldMetadata = protoFilesRoot.lookup( + '.google.cloud.resourcemanager.v3.DeleteTagHoldMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createTagHold: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createTagHoldResponse.decode.bind(createTagHoldResponse), + createTagHoldMetadata.decode.bind(createTagHoldMetadata) + ), + deleteTagHold: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteTagHoldResponse.decode.bind(deleteTagHoldResponse), + deleteTagHoldMetadata.decode.bind(deleteTagHoldMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.resourcemanager.v3.TagHolds', + 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 + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.tagHoldsStub) { + return this.tagHoldsStub; + } + + // Put together the "service stub" for + // google.cloud.resourcemanager.v3.TagHolds. + this.tagHoldsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.resourcemanager.v3.TagHolds' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.resourcemanager.v3.TagHolds, + 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 tagHoldsStubMethods = [ + 'createTagHold', + 'deleteTagHold', + 'listTagHolds', + ]; + for (const methodName of tagHoldsStubMethods) { + const callPromise = this.tagHoldsStub.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) => () => { + throw err; + } + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.tagHoldsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudresourcemanager.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudresourcemanager.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-platform.read-only', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * 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 { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same + * resource and origin exists under the same TagValue. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the TagHold's parent TagValue. Must be of + * the form: `tagValues/{tag-value-id}`. + * @param {google.cloud.resourcemanager.v3.TagHold} request.tagHold + * Required. The TagHold to be created. + * @param {boolean} [request.validateOnly] + * Optional. Set to true to perform the validations necessary for creating the + * resource, but not actually perform the action. + * @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/v3/tag_holds.create_tag_hold.js + * region_tag:cloudresourcemanager_v3_generated_TagHolds_CreateTagHold_async + */ + createTagHold( + request?: protos.google.cloud.resourcemanager.v3.ICreateTagHoldRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.resourcemanager.v3.ITagHold, + protos.google.cloud.resourcemanager.v3.ICreateTagHoldMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createTagHold( + request: protos.google.cloud.resourcemanager.v3.ICreateTagHoldRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.resourcemanager.v3.ITagHold, + protos.google.cloud.resourcemanager.v3.ICreateTagHoldMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createTagHold( + request: protos.google.cloud.resourcemanager.v3.ICreateTagHoldRequest, + callback: Callback< + LROperation< + protos.google.cloud.resourcemanager.v3.ITagHold, + protos.google.cloud.resourcemanager.v3.ICreateTagHoldMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createTagHold( + request?: protos.google.cloud.resourcemanager.v3.ICreateTagHoldRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.resourcemanager.v3.ITagHold, + protos.google.cloud.resourcemanager.v3.ICreateTagHoldMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.resourcemanager.v3.ITagHold, + protos.google.cloud.resourcemanager.v3.ICreateTagHoldMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.resourcemanager.v3.ITagHold, + protos.google.cloud.resourcemanager.v3.ICreateTagHoldMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createTagHold(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createTagHold()`. + * @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/v3/tag_holds.create_tag_hold.js + * region_tag:cloudresourcemanager_v3_generated_TagHolds_CreateTagHold_async + */ + async checkCreateTagHoldProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.resourcemanager.v3.TagHold, + protos.google.cloud.resourcemanager.v3.CreateTagHoldMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createTagHold, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.resourcemanager.v3.TagHold, + protos.google.cloud.resourcemanager.v3.CreateTagHoldMetadata + >; + } + /** + * Deletes a TagHold. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the TagHold to delete. Must be of the form: + * `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}`. + * @param {boolean} [request.validateOnly] + * Optional. Set to true to perform the validations necessary for deleting the + * resource, but not actually perform the action. + * @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/v3/tag_holds.delete_tag_hold.js + * region_tag:cloudresourcemanager_v3_generated_TagHolds_DeleteTagHold_async + */ + deleteTagHold( + request?: protos.google.cloud.resourcemanager.v3.IDeleteTagHoldRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteTagHold( + request: protos.google.cloud.resourcemanager.v3.IDeleteTagHoldRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteTagHold( + request: protos.google.cloud.resourcemanager.v3.IDeleteTagHoldRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteTagHold( + request?: protos.google.cloud.resourcemanager.v3.IDeleteTagHoldRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteTagHold(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteTagHold()`. + * @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/v3/tag_holds.delete_tag_hold.js + * region_tag:cloudresourcemanager_v3_generated_TagHolds_DeleteTagHold_async + */ + async checkDeleteTagHoldProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteTagHold, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.resourcemanager.v3.DeleteTagHoldMetadata + >; + } + /** + * Lists TagHolds under a TagValue. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the parent TagValue. Must be of the form: + * `tagValues/{tag-value-id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of TagHolds to return in the response. The + * server allows a maximum of 300 TagHolds to return. If unspecified, the + * server will use 100 as the default. + * @param {string} [request.pageToken] + * Optional. A pagination token returned from a previous call to + * `ListTagHolds` that indicates where this listing should continue from. + * @param {string} [request.filter] + * Optional. Criteria used to select a subset of TagHolds parented by the + * TagValue to return. This field follows the syntax defined by aip.dev/160; + * the `holder` and `origin` fields are supported for filtering. Currently + * only `AND` syntax is supported. Some example queries are: + * + * * `holder = + * //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group` + * * `origin = 35678234` + * * `holder = + * //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group + * AND origin = 35678234` + * @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 {@link google.cloud.resourcemanager.v3.TagHold | TagHold}. + * 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 `listTagHoldsAsync()` + * 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. + */ + listTagHolds( + request?: protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.resourcemanager.v3.ITagHold[], + protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest | null, + protos.google.cloud.resourcemanager.v3.IListTagHoldsResponse + ] + >; + listTagHolds( + request: protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + | protos.google.cloud.resourcemanager.v3.IListTagHoldsResponse + | null + | undefined, + protos.google.cloud.resourcemanager.v3.ITagHold + > + ): void; + listTagHolds( + request: protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + callback: PaginationCallback< + protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + | protos.google.cloud.resourcemanager.v3.IListTagHoldsResponse + | null + | undefined, + protos.google.cloud.resourcemanager.v3.ITagHold + > + ): void; + listTagHolds( + request?: protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + | protos.google.cloud.resourcemanager.v3.IListTagHoldsResponse + | null + | undefined, + protos.google.cloud.resourcemanager.v3.ITagHold + >, + callback?: PaginationCallback< + protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + | protos.google.cloud.resourcemanager.v3.IListTagHoldsResponse + | null + | undefined, + protos.google.cloud.resourcemanager.v3.ITagHold + > + ): Promise< + [ + protos.google.cloud.resourcemanager.v3.ITagHold[], + protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest | null, + protos.google.cloud.resourcemanager.v3.IListTagHoldsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listTagHolds(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 resource name of the parent TagValue. Must be of the form: + * `tagValues/{tag-value-id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of TagHolds to return in the response. The + * server allows a maximum of 300 TagHolds to return. If unspecified, the + * server will use 100 as the default. + * @param {string} [request.pageToken] + * Optional. A pagination token returned from a previous call to + * `ListTagHolds` that indicates where this listing should continue from. + * @param {string} [request.filter] + * Optional. Criteria used to select a subset of TagHolds parented by the + * TagValue to return. This field follows the syntax defined by aip.dev/160; + * the `holder` and `origin` fields are supported for filtering. Currently + * only `AND` syntax is supported. Some example queries are: + * + * * `holder = + * //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group` + * * `origin = 35678234` + * * `holder = + * //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group + * AND origin = 35678234` + * @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 {@link google.cloud.resourcemanager.v3.TagHold | TagHold} 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 `listTagHoldsAsync()` + * 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. + */ + listTagHoldsStream( + request?: protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listTagHolds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTagHolds.createStream( + this.innerApiCalls.listTagHolds as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listTagHolds`, 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 resource name of the parent TagValue. Must be of the form: + * `tagValues/{tag-value-id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of TagHolds to return in the response. The + * server allows a maximum of 300 TagHolds to return. If unspecified, the + * server will use 100 as the default. + * @param {string} [request.pageToken] + * Optional. A pagination token returned from a previous call to + * `ListTagHolds` that indicates where this listing should continue from. + * @param {string} [request.filter] + * Optional. Criteria used to select a subset of TagHolds parented by the + * TagValue to return. This field follows the syntax defined by aip.dev/160; + * the `holder` and `origin` fields are supported for filtering. Currently + * only `AND` syntax is supported. Some example queries are: + * + * * `holder = + * //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group` + * * `origin = 35678234` + * * `holder = + * //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group + * AND origin = 35678234` + * @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 + * {@link google.cloud.resourcemanager.v3.TagHold | TagHold}. 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/v3/tag_holds.list_tag_holds.js + * region_tag:cloudresourcemanager_v3_generated_TagHolds_ListTagHolds_async + */ + listTagHoldsAsync( + request?: protos.google.cloud.resourcemanager.v3.IListTagHoldsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listTagHolds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTagHolds.asyncIterate( + this.innerApiCalls['listTagHolds'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 -- + // -------------------- + + /** + * Return a fully-qualified folder resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderPath(folder: string) { + return this.pathTemplates.folderPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from Folder resource. + * + * @param {string} folderName + * A fully-qualified path representing Folder resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderName(folderName: string) { + return this.pathTemplates.folderPathTemplate.match(folderName).folder; + } + + /** + * Return a fully-qualified organization resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationPath(organization: string) { + return this.pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from Organization resource. + * + * @param {string} organizationName + * A fully-qualified path representing Organization resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName: string) { + return this.pathTemplates.organizationPathTemplate.match(organizationName) + .organization; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified tagBinding resource name string. + * + * @param {string} tag_binding + * @returns {string} Resource name string. + */ + tagBindingPath(tagBinding: string) { + return this.pathTemplates.tagBindingPathTemplate.render({ + tag_binding: tagBinding, + }); + } + + /** + * Parse the tag_binding from TagBinding resource. + * + * @param {string} tagBindingName + * A fully-qualified path representing TagBinding resource. + * @returns {string} A string representing the tag_binding. + */ + matchTagBindingFromTagBindingName(tagBindingName: string) { + return this.pathTemplates.tagBindingPathTemplate.match(tagBindingName) + .tag_binding; + } + + /** + * Return a fully-qualified tagHold resource name string. + * + * @param {string} tag_value + * @param {string} tag_hold + * @returns {string} Resource name string. + */ + tagHoldPath(tagValue: string, tagHold: string) { + return this.pathTemplates.tagHoldPathTemplate.render({ + tag_value: tagValue, + tag_hold: tagHold, + }); + } + + /** + * Parse the tag_value from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_value. + */ + matchTagValueFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_value; + } + + /** + * Parse the tag_hold from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_hold. + */ + matchTagHoldFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_hold; + } + + /** + * Return a fully-qualified tagKey resource name string. + * + * @param {string} tag_key + * @returns {string} Resource name string. + */ + tagKeyPath(tagKey: string) { + return this.pathTemplates.tagKeyPathTemplate.render({ + tag_key: tagKey, + }); + } + + /** + * Parse the tag_key from TagKey resource. + * + * @param {string} tagKeyName + * A fully-qualified path representing TagKey resource. + * @returns {string} A string representing the tag_key. + */ + matchTagKeyFromTagKeyName(tagKeyName: string) { + return this.pathTemplates.tagKeyPathTemplate.match(tagKeyName).tag_key; + } + + /** + * Return a fully-qualified tagValue resource name string. + * + * @param {string} tag_value + * @returns {string} Resource name string. + */ + tagValuePath(tagValue: string) { + return this.pathTemplates.tagValuePathTemplate.render({ + tag_value: tagValue, + }); + } + + /** + * Parse the tag_value from TagValue resource. + * + * @param {string} tagValueName + * A fully-qualified path representing TagValue resource. + * @returns {string} A string representing the tag_value. + */ + matchTagValueFromTagValueName(tagValueName: string) { + return this.pathTemplates.tagValuePathTemplate.match(tagValueName) + .tag_value; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.tagHoldsStub && !this._terminated) { + return this.tagHoldsStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_holds_client_config.json b/packages/google-cloud-resourcemanager/src/v3/tag_holds_client_config.json new file mode 100644 index 000000000000..5b42806f40bc --- /dev/null +++ b/packages/google-cloud-resourcemanager/src/v3/tag_holds_client_config.json @@ -0,0 +1,38 @@ +{ + "interfaces": { + "google.cloud.resourcemanager.v3.TagHolds": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateTagHold": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteTagHold": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListTagHolds": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_holds_proto_list.json b/packages/google-cloud-resourcemanager/src/v3/tag_holds_proto_list.json new file mode 100644 index 000000000000..639794aadd4b --- /dev/null +++ b/packages/google-cloud-resourcemanager/src/v3/tag_holds_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/resourcemanager/v3/folders.proto", + "../../protos/google/cloud/resourcemanager/v3/organizations.proto", + "../../protos/google/cloud/resourcemanager/v3/projects.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_bindings.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_holds.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_keys.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_values.proto" +] diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_keys_client.ts b/packages/google-cloud-resourcemanager/src/v3/tag_keys_client.ts index 6173c6daf055..f65b0a0e1b66 100644 --- a/packages/google-cloud-resourcemanager/src/v3/tag_keys_client.ts +++ b/packages/google-cloud-resourcemanager/src/v3/tag_keys_client.ts @@ -191,6 +191,9 @@ export class TagKeysClient { tagBindingPathTemplate: new this._gaxModule.PathTemplate( 'tagBindings/{tag_binding}' ), + tagHoldPathTemplate: new this._gaxModule.PathTemplate( + 'tagValues/{tag_value}/tagHolds/{tag_hold}' + ), tagKeyPathTemplate: new this._gaxModule.PathTemplate('tagKeys/{tag_key}'), tagValuePathTemplate: new this._gaxModule.PathTemplate( 'tagValues/{tag_value}' @@ -317,6 +320,7 @@ export class TagKeysClient { const tagKeysStubMethods = [ 'listTagKeys', 'getTagKey', + 'getNamespacedTagKey', 'createTagKey', 'updateTagKey', 'deleteTagKey', @@ -505,6 +509,104 @@ export class TagKeysClient { this.initialize(); return this.innerApiCalls.getTagKey(request, options, callback); } + /** + * Retrieves a TagKey by its namespaced name. + * This method will return `PERMISSION_DENIED` if the key does not exist + * or the user does not have permission to view it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A namespaced tag key name in the format + * `{parentId}/{tagKeyShort}`, such as `42/foo` for a key with short name + * "foo" under the organization with ID 42 or `r2-d2/bar` for a key with short + * name "bar" under the project `r2-d2`. + * @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 {@link google.cloud.resourcemanager.v3.TagKey | TagKey}. + * 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/v3/tag_keys.get_namespaced_tag_key.js + * region_tag:cloudresourcemanager_v3_generated_TagKeys_GetNamespacedTagKey_async + */ + getNamespacedTagKey( + request?: protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.resourcemanager.v3.ITagKey, + ( + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest + | undefined + ), + {} | undefined + ] + >; + getNamespacedTagKey( + request: protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.resourcemanager.v3.ITagKey, + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getNamespacedTagKey( + request: protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest, + callback: Callback< + protos.google.cloud.resourcemanager.v3.ITagKey, + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getNamespacedTagKey( + request?: protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.resourcemanager.v3.ITagKey, + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.resourcemanager.v3.ITagKey, + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.resourcemanager.v3.ITagKey, + ( + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagKeyRequest + | 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 || {}; + this.initialize(); + return this.innerApiCalls.getNamespacedTagKey(request, options, callback); + } /** * Gets the access control policy for a TagKey. The returned policy may be * empty if no such policy or resource exists. The `resource` field should @@ -793,17 +895,17 @@ export class TagKeysClient { /** * Creates a new TagKey. If another request with the same parameters is * sent while the original request is in process, the second request - * will receive an error. A maximum of 300 TagKeys can exist under a parent at - * any given time. + * will receive an error. A maximum of 1000 TagKeys can exist under a parent + * at any given time. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.resourcemanager.v3.TagKey} request.tagKey - * Required. The TagKey to be created. Only fields `short_name`, `description`, - * and `parent` are considered during the creation request. + * Required. The TagKey to be created. Only fields `short_name`, + * `description`, and `parent` are considered during the creation request. * @param {boolean} [request.validateOnly] - * Optional. Set to true to perform validations necessary for creating the resource, but - * not actually perform the action. + * Optional. Set to true to perform validations necessary for creating the + * resource, but not actually perform the action. * @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. @@ -937,10 +1039,10 @@ export class TagKeysClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.resourcemanager.v3.TagKey} request.tagKey - * Required. The new definition of the TagKey. Only the `description` and `etag` fields - * can be updated by this request. If the `etag` field is not empty, it - * must match the `etag` field of the existing tag key. Otherwise, - * `FAILED_PRECONDITION` will be returned. + * Required. The new definition of the TagKey. Only the `description` and + * `etag` fields can be updated by this request. If the `etag` field is not + * empty, it must match the `etag` field of the existing tag key. Otherwise, + * `ABORTED` will be returned. * @param {google.protobuf.FieldMask} request.updateMask * Fields to be updated. The mask may only contain `description` or * `etag`. If omitted entirely, both `description` and `etag` are assumed to @@ -1086,15 +1188,15 @@ export class TagKeysClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The resource name of a TagKey to be deleted in the format `tagKeys/123`. - * The TagKey cannot be a parent of any existing TagValues or it will not be - * deleted successfully. + * Required. The resource name of a TagKey to be deleted in the format + * `tagKeys/123`. The TagKey cannot be a parent of any existing TagValues or + * it will not be deleted successfully. * @param {boolean} [request.validateOnly] - * Optional. Set as true to perform validations necessary for deletion, but not actually - * perform the action. + * Optional. Set as true to perform validations necessary for deletion, but + * not actually perform the action. * @param {string} [request.etag] - * Optional. The etag known to the client for the expected state of the TagKey. This is - * to be used for optimistic concurrency. + * Optional. The etag known to the client for the expected state of the + * TagKey. This is to be used for optimistic concurrency. * @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. @@ -1235,9 +1337,9 @@ export class TagKeysClient { * Required. The resource name of the new TagKey's parent. * Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. * @param {number} [request.pageSize] - * Optional. The maximum number of TagKeys to return in the response. The server allows - * a maximum of 300 TagKeys to return. If unspecified, the server will use 100 - * as the default. + * Optional. The maximum number of TagKeys to return in the response. The + * server allows a maximum of 300 TagKeys to return. If unspecified, the + * server will use 100 as the default. * @param {string} [request.pageToken] * Optional. A pagination token returned from a previous call to `ListTagKey` * that indicates where this listing should continue from. @@ -1333,9 +1435,9 @@ export class TagKeysClient { * Required. The resource name of the new TagKey's parent. * Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. * @param {number} [request.pageSize] - * Optional. The maximum number of TagKeys to return in the response. The server allows - * a maximum of 300 TagKeys to return. If unspecified, the server will use 100 - * as the default. + * Optional. The maximum number of TagKeys to return in the response. The + * server allows a maximum of 300 TagKeys to return. If unspecified, the + * server will use 100 as the default. * @param {string} [request.pageToken] * Optional. A pagination token returned from a previous call to `ListTagKey` * that indicates where this listing should continue from. @@ -1379,9 +1481,9 @@ export class TagKeysClient { * Required. The resource name of the new TagKey's parent. * Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. * @param {number} [request.pageSize] - * Optional. The maximum number of TagKeys to return in the response. The server allows - * a maximum of 300 TagKeys to return. If unspecified, the server will use 100 - * as the default. + * Optional. The maximum number of TagKeys to return in the response. The + * server allows a maximum of 300 TagKeys to return. If unspecified, the + * server will use 100 as the default. * @param {string} [request.pageToken] * Optional. A pagination token returned from a previous call to `ListTagKey` * that indicates where this listing should continue from. @@ -1415,6 +1517,181 @@ export class TagKeysClient { callSettings ) as AsyncIterable; } + /** + * 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 -- // -------------------- @@ -1513,6 +1790,42 @@ export class TagKeysClient { .tag_binding; } + /** + * Return a fully-qualified tagHold resource name string. + * + * @param {string} tag_value + * @param {string} tag_hold + * @returns {string} Resource name string. + */ + tagHoldPath(tagValue: string, tagHold: string) { + return this.pathTemplates.tagHoldPathTemplate.render({ + tag_value: tagValue, + tag_hold: tagHold, + }); + } + + /** + * Parse the tag_value from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_value. + */ + matchTagValueFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_value; + } + + /** + * Parse the tag_hold from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_hold. + */ + matchTagHoldFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_hold; + } + /** * Return a fully-qualified tagKey resource name string. * diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_keys_client_config.json b/packages/google-cloud-resourcemanager/src/v3/tag_keys_client_config.json index b72c6518fd29..f1e7c83955da 100644 --- a/packages/google-cloud-resourcemanager/src/v3/tag_keys_client_config.json +++ b/packages/google-cloud-resourcemanager/src/v3/tag_keys_client_config.json @@ -33,6 +33,10 @@ "retry_codes_name": "unavailable", "retry_params_name": "default" }, + "GetNamespacedTagKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "CreateTagKey": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_keys_proto_list.json b/packages/google-cloud-resourcemanager/src/v3/tag_keys_proto_list.json index 0c0066033c06..639794aadd4b 100644 --- a/packages/google-cloud-resourcemanager/src/v3/tag_keys_proto_list.json +++ b/packages/google-cloud-resourcemanager/src/v3/tag_keys_proto_list.json @@ -3,6 +3,7 @@ "../../protos/google/cloud/resourcemanager/v3/organizations.proto", "../../protos/google/cloud/resourcemanager/v3/projects.proto", "../../protos/google/cloud/resourcemanager/v3/tag_bindings.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_holds.proto", "../../protos/google/cloud/resourcemanager/v3/tag_keys.proto", "../../protos/google/cloud/resourcemanager/v3/tag_values.proto" ] diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_values_client.ts b/packages/google-cloud-resourcemanager/src/v3/tag_values_client.ts index a10dacc7c660..b4c922d78316 100644 --- a/packages/google-cloud-resourcemanager/src/v3/tag_values_client.ts +++ b/packages/google-cloud-resourcemanager/src/v3/tag_values_client.ts @@ -191,6 +191,9 @@ export class TagValuesClient { tagBindingPathTemplate: new this._gaxModule.PathTemplate( 'tagBindings/{tag_binding}' ), + tagHoldPathTemplate: new this._gaxModule.PathTemplate( + 'tagValues/{tag_value}/tagHolds/{tag_hold}' + ), tagKeyPathTemplate: new this._gaxModule.PathTemplate('tagKeys/{tag_key}'), tagValuePathTemplate: new this._gaxModule.PathTemplate( 'tagValues/{tag_value}' @@ -317,6 +320,7 @@ export class TagValuesClient { const tagValuesStubMethods = [ 'listTagValues', 'getTagValue', + 'getNamespacedTagValue', 'createTagValue', 'updateTagValue', 'deleteTagValue', @@ -413,14 +417,14 @@ export class TagValuesClient { // -- Service calls -- // ------------------- /** - * Retrieves TagValue. If the TagValue or namespaced name does not exist, or - * if the user does not have permission to view it, this method will return - * `PERMISSION_DENIED`. + * Retrieves a TagValue. This method will return `PERMISSION_DENIED` if the + * value does not exist or the user does not have permission to view it. * * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. Resource name for TagValue to be fetched in the format `tagValues/456`. + * Required. Resource name for TagValue to be fetched in the format + * `tagValues/456`. * @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. @@ -505,6 +509,109 @@ export class TagValuesClient { this.initialize(); return this.innerApiCalls.getTagValue(request, options, callback); } + /** + * Retrieves a TagValue by its namespaced name. + * This method will return `PERMISSION_DENIED` if the value does not exist + * or the user does not have permission to view it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A namespaced tag value name in the following format: + * + * `{parentId}/{tagKeyShort}/{tagValueShort}` + * + * Examples: + * - `42/foo/abc` for a value with short name "abc" under the key with short + * name "foo" under the organization with ID 42 + * - `r2-d2/bar/xyz` for a value with short name "xyz" under the key with + * short name "bar" under the project with ID "r2-d2" + * @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 {@link google.cloud.resourcemanager.v3.TagValue | TagValue}. + * 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/v3/tag_values.get_namespaced_tag_value.js + * region_tag:cloudresourcemanager_v3_generated_TagValues_GetNamespacedTagValue_async + */ + getNamespacedTagValue( + request?: protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.resourcemanager.v3.ITagValue, + ( + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest + | undefined + ), + {} | undefined + ] + >; + getNamespacedTagValue( + request: protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.resourcemanager.v3.ITagValue, + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getNamespacedTagValue( + request: protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest, + callback: Callback< + protos.google.cloud.resourcemanager.v3.ITagValue, + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getNamespacedTagValue( + request?: protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.resourcemanager.v3.ITagValue, + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.resourcemanager.v3.ITagValue, + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.resourcemanager.v3.ITagValue, + ( + | protos.google.cloud.resourcemanager.v3.IGetNamespacedTagValueRequest + | 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 || {}; + this.initialize(); + return this.innerApiCalls.getNamespacedTagValue(request, options, callback); + } /** * Gets the access control policy for a TagValue. The returned policy may be * empty if no such policy or resource exists. The `resource` field should @@ -793,17 +900,17 @@ export class TagValuesClient { /** * Creates a TagValue as a child of the specified TagKey. If a another * request with the same parameters is sent while the original request is in - * process the second request will receive an error. A maximum of 300 + * process the second request will receive an error. A maximum of 1000 * TagValues can exist under a TagKey at any given time. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.resourcemanager.v3.TagValue} request.tagValue - * Required. The TagValue to be created. Only fields `short_name`, `description`, - * and `parent` are considered during the creation request. + * Required. The TagValue to be created. Only fields `short_name`, + * `description`, and `parent` are considered during the creation request. * @param {boolean} [request.validateOnly] - * Optional. Set as true to perform the validations necessary for creating the resource, - * but not actually perform the action. + * Optional. Set as true to perform the validations necessary for creating the + * resource, but not actually perform the action. * @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. @@ -937,15 +1044,15 @@ export class TagValuesClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.resourcemanager.v3.TagValue} request.tagValue - * Required. The new definition of the TagValue. Only fields `description` and `etag` - * fields can be updated by this request. If the `etag` field is nonempty, it - * must match the `etag` field of the existing ControlGroup. Otherwise, - * `FAILED_PRECONDITION` will be returned. + * Required. The new definition of the TagValue. Only fields `description` and + * `etag` fields can be updated by this request. If the `etag` field is + * nonempty, it must match the `etag` field of the existing ControlGroup. + * Otherwise, `ABORTED` will be returned. * @param {google.protobuf.FieldMask} [request.updateMask] * Optional. Fields to be updated. * @param {boolean} [request.validateOnly] - * Optional. True to perform validations necessary for updating the resource, but not - * actually perform the action. + * Optional. True to perform validations necessary for updating the resource, + * but not actually perform the action. * @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. @@ -1084,13 +1191,14 @@ export class TagValuesClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. Resource name for TagValue to be deleted in the format tagValues/456. + * Required. Resource name for TagValue to be deleted in the format + * tagValues/456. * @param {boolean} [request.validateOnly] - * Optional. Set as true to perform the validations necessary for deletion, but not - * actually perform the action. + * Optional. Set as true to perform the validations necessary for deletion, + * but not actually perform the action. * @param {string} [request.etag] - * Optional. The etag known to the client for the expected state of the TagValue. This - * is to be used for optimistic concurrency. + * Optional. The etag known to the client for the expected state of the + * TagValue. This is to be used for optimistic concurrency. * @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. @@ -1228,15 +1336,14 @@ export class TagValuesClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. Resource name for TagKey, parent of the TagValues to be listed, - * in the format `tagKeys/123`. + * Required. * @param {number} [request.pageSize] - * Optional. The maximum number of TagValues to return in the response. The server - * allows a maximum of 300 TagValues to return. If unspecified, the server - * will use 100 as the default. + * Optional. The maximum number of TagValues to return in the response. The + * server allows a maximum of 300 TagValues to return. If unspecified, the + * server will use 100 as the default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `ListTagValues` - * that indicates where this listing should continue from. + * Optional. A pagination token returned from a previous call to + * `ListTagValues` that indicates where this listing should continue from. * @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. @@ -1326,15 +1433,14 @@ export class TagValuesClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. Resource name for TagKey, parent of the TagValues to be listed, - * in the format `tagKeys/123`. + * Required. * @param {number} [request.pageSize] - * Optional. The maximum number of TagValues to return in the response. The server - * allows a maximum of 300 TagValues to return. If unspecified, the server - * will use 100 as the default. + * Optional. The maximum number of TagValues to return in the response. The + * server allows a maximum of 300 TagValues to return. If unspecified, the + * server will use 100 as the default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `ListTagValues` - * that indicates where this listing should continue from. + * Optional. A pagination token returned from a previous call to + * `ListTagValues` that indicates where this listing should continue from. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -1372,15 +1478,14 @@ export class TagValuesClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. Resource name for TagKey, parent of the TagValues to be listed, - * in the format `tagKeys/123`. + * Required. * @param {number} [request.pageSize] - * Optional. The maximum number of TagValues to return in the response. The server - * allows a maximum of 300 TagValues to return. If unspecified, the server - * will use 100 as the default. + * Optional. The maximum number of TagValues to return in the response. The + * server allows a maximum of 300 TagValues to return. If unspecified, the + * server will use 100 as the default. * @param {string} [request.pageToken] - * Optional. A pagination token returned from a previous call to `ListTagValues` - * that indicates where this listing should continue from. + * Optional. A pagination token returned from a previous call to + * `ListTagValues` that indicates where this listing should continue from. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -1411,6 +1516,181 @@ export class TagValuesClient { callSettings ) as AsyncIterable; } + /** + * 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 | 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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.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 -- // -------------------- @@ -1509,6 +1789,42 @@ export class TagValuesClient { .tag_binding; } + /** + * Return a fully-qualified tagHold resource name string. + * + * @param {string} tag_value + * @param {string} tag_hold + * @returns {string} Resource name string. + */ + tagHoldPath(tagValue: string, tagHold: string) { + return this.pathTemplates.tagHoldPathTemplate.render({ + tag_value: tagValue, + tag_hold: tagHold, + }); + } + + /** + * Parse the tag_value from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_value. + */ + matchTagValueFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_value; + } + + /** + * Parse the tag_hold from TagHold resource. + * + * @param {string} tagHoldName + * A fully-qualified path representing TagHold resource. + * @returns {string} A string representing the tag_hold. + */ + matchTagHoldFromTagHoldName(tagHoldName: string) { + return this.pathTemplates.tagHoldPathTemplate.match(tagHoldName).tag_hold; + } + /** * Return a fully-qualified tagKey resource name string. * diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_values_client_config.json b/packages/google-cloud-resourcemanager/src/v3/tag_values_client_config.json index 01ac77022d9d..6ddb1d9c83a6 100644 --- a/packages/google-cloud-resourcemanager/src/v3/tag_values_client_config.json +++ b/packages/google-cloud-resourcemanager/src/v3/tag_values_client_config.json @@ -33,6 +33,10 @@ "retry_codes_name": "unavailable", "retry_params_name": "default" }, + "GetNamespacedTagValue": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "CreateTagValue": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", diff --git a/packages/google-cloud-resourcemanager/src/v3/tag_values_proto_list.json b/packages/google-cloud-resourcemanager/src/v3/tag_values_proto_list.json index 0c0066033c06..639794aadd4b 100644 --- a/packages/google-cloud-resourcemanager/src/v3/tag_values_proto_list.json +++ b/packages/google-cloud-resourcemanager/src/v3/tag_values_proto_list.json @@ -3,6 +3,7 @@ "../../protos/google/cloud/resourcemanager/v3/organizations.proto", "../../protos/google/cloud/resourcemanager/v3/projects.proto", "../../protos/google/cloud/resourcemanager/v3/tag_bindings.proto", + "../../protos/google/cloud/resourcemanager/v3/tag_holds.proto", "../../protos/google/cloud/resourcemanager/v3/tag_keys.proto", "../../protos/google/cloud/resourcemanager/v3/tag_values.proto" ] diff --git a/packages/google-cloud-resourcemanager/system-test/fixtures/sample/src/index.js b/packages/google-cloud-resourcemanager/system-test/fixtures/sample/src/index.js index 0bc9fa6016ec..993e317bab61 100644 --- a/packages/google-cloud-resourcemanager/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-resourcemanager/system-test/fixtures/sample/src/index.js @@ -24,6 +24,7 @@ function main() { const organizationsClient = new resourcemanager.OrganizationsClient(); const projectsClient = new resourcemanager.ProjectsClient(); const tagBindingsClient = new resourcemanager.TagBindingsClient(); + const tagHoldsClient = new resourcemanager.TagHoldsClient(); const tagKeysClient = new resourcemanager.TagKeysClient(); const tagValuesClient = new resourcemanager.TagValuesClient(); } diff --git a/packages/google-cloud-resourcemanager/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-resourcemanager/system-test/fixtures/sample/src/index.ts index 8165d20384cf..add7058c1bd5 100644 --- a/packages/google-cloud-resourcemanager/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-resourcemanager/system-test/fixtures/sample/src/index.ts @@ -21,6 +21,7 @@ import { OrganizationsClient, ProjectsClient, TagBindingsClient, + TagHoldsClient, TagKeysClient, TagValuesClient, } from '@google-cloud/resource-manager'; @@ -38,6 +39,9 @@ function doStuffWithProjectsClient(client: ProjectsClient) { function doStuffWithTagBindingsClient(client: TagBindingsClient) { client.close(); } +function doStuffWithTagHoldsClient(client: TagHoldsClient) { + client.close(); +} function doStuffWithTagKeysClient(client: TagKeysClient) { client.close(); } @@ -59,6 +63,9 @@ function main() { const tagBindingsClient = new TagBindingsClient(); doStuffWithTagBindingsClient(tagBindingsClient); // check that the client instance can be created + const tagHoldsClient = new TagHoldsClient(); + doStuffWithTagHoldsClient(tagHoldsClient); + // check that the client instance can be created const tagKeysClient = new TagKeysClient(); doStuffWithTagKeysClient(tagKeysClient); // check that the client instance can be created diff --git a/packages/google-cloud-resourcemanager/test/gapic_folders_v3.ts b/packages/google-cloud-resourcemanager/test/gapic_folders_v3.ts index d8c845b60d20..f5025b7cb231 100644 --- a/packages/google-cloud-resourcemanager/test/gapic_folders_v3.ts +++ b/packages/google-cloud-resourcemanager/test/gapic_folders_v3.ts @@ -2142,6 +2142,311 @@ describe('v3.FoldersClient', () => { ); }); }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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 foldersModule.v3.FoldersClient({ + 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('folder', () => { @@ -2296,6 +2601,55 @@ describe('v3.FoldersClient', () => { }); }); + describe('tagHold', () => { + const fakePath = '/rendered/path/tagHold'; + const expectedParameters = { + tag_value: 'tagValueValue', + tag_hold: 'tagHoldValue', + }; + const client = new foldersModule.v3.FoldersClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagHoldPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagHoldPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagHoldPath', () => { + const result = client.tagHoldPath('tagValueValue', 'tagHoldValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagHoldPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagValueFromTagHoldName', () => { + const result = client.matchTagValueFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagValueValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTagHoldFromTagHoldName', () => { + const result = client.matchTagHoldFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagHoldValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('tagKey', () => { const fakePath = '/rendered/path/tagKey'; const expectedParameters = { diff --git a/packages/google-cloud-resourcemanager/test/gapic_organizations_v3.ts b/packages/google-cloud-resourcemanager/test/gapic_organizations_v3.ts index d68021722237..888779888ef0 100644 --- a/packages/google-cloud-resourcemanager/test/gapic_organizations_v3.ts +++ b/packages/google-cloud-resourcemanager/test/gapic_organizations_v3.ts @@ -1139,6 +1139,55 @@ describe('v3.OrganizationsClient', () => { }); }); + describe('tagHold', () => { + const fakePath = '/rendered/path/tagHold'; + const expectedParameters = { + tag_value: 'tagValueValue', + tag_hold: 'tagHoldValue', + }; + const client = new organizationsModule.v3.OrganizationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagHoldPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagHoldPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagHoldPath', () => { + const result = client.tagHoldPath('tagValueValue', 'tagHoldValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagHoldPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagValueFromTagHoldName', () => { + const result = client.matchTagValueFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagValueValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTagHoldFromTagHoldName', () => { + const result = client.matchTagHoldFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagHoldValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('tagKey', () => { const fakePath = '/rendered/path/tagKey'; const expectedParameters = { diff --git a/packages/google-cloud-resourcemanager/test/gapic_projects_v3.ts b/packages/google-cloud-resourcemanager/test/gapic_projects_v3.ts index 4db8a42075bd..79c09a259d42 100644 --- a/packages/google-cloud-resourcemanager/test/gapic_projects_v3.ts +++ b/packages/google-cloud-resourcemanager/test/gapic_projects_v3.ts @@ -2155,6 +2155,311 @@ describe('v3.ProjectsClient', () => { ); }); }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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 projectsModule.v3.ProjectsClient({ + 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('folder', () => { @@ -2309,6 +2614,55 @@ describe('v3.ProjectsClient', () => { }); }); + describe('tagHold', () => { + const fakePath = '/rendered/path/tagHold'; + const expectedParameters = { + tag_value: 'tagValueValue', + tag_hold: 'tagHoldValue', + }; + const client = new projectsModule.v3.ProjectsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagHoldPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagHoldPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagHoldPath', () => { + const result = client.tagHoldPath('tagValueValue', 'tagHoldValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagHoldPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagValueFromTagHoldName', () => { + const result = client.matchTagValueFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagValueValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTagHoldFromTagHoldName', () => { + const result = client.matchTagHoldFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagHoldValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('tagKey', () => { const fakePath = '/rendered/path/tagKey'; const expectedParameters = { diff --git a/packages/google-cloud-resourcemanager/test/gapic_tag_bindings_v3.ts b/packages/google-cloud-resourcemanager/test/gapic_tag_bindings_v3.ts index 61aed3ec3ad0..63ba88036b2e 100644 --- a/packages/google-cloud-resourcemanager/test/gapic_tag_bindings_v3.ts +++ b/packages/google-cloud-resourcemanager/test/gapic_tag_bindings_v3.ts @@ -824,6 +824,548 @@ describe('v3.TagBindingsClient', () => { }); }); + describe('listEffectiveTags', () => { + it('invokes listEffectiveTags without error', async () => { + const client = new tagbindingsModule.v3.TagBindingsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + ]; + client.innerApiCalls.listEffectiveTags = stubSimpleCall(expectedResponse); + const [response] = await client.listEffectiveTags(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listEffectiveTags without error using callback', async () => { + const client = new tagbindingsModule.v3.TagBindingsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + ]; + client.innerApiCalls.listEffectiveTags = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEffectiveTags( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.resourcemanager.v3.IEffectiveTag[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listEffectiveTags with error', async () => { + const client = new tagbindingsModule.v3.TagBindingsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listEffectiveTags = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listEffectiveTags(request), expectedError); + }); + + it('invokes listEffectiveTagsStream without error', async () => { + const client = new tagbindingsModule.v3.TagBindingsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + ]; + client.descriptors.page.listEffectiveTags.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listEffectiveTagsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.resourcemanager.v3.EffectiveTag[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.resourcemanager.v3.EffectiveTag) => { + 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.listEffectiveTags.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEffectiveTags, request) + ); + }); + + it('invokes listEffectiveTagsStream with error', async () => { + const client = new tagbindingsModule.v3.TagBindingsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listEffectiveTags.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listEffectiveTagsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.resourcemanager.v3.EffectiveTag[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.resourcemanager.v3.EffectiveTag) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEffectiveTags.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEffectiveTags, request) + ); + }); + + it('uses async iteration with listEffectiveTags without error', async () => { + const client = new tagbindingsModule.v3.TagBindingsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.EffectiveTag() + ), + ]; + client.descriptors.page.listEffectiveTags.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.resourcemanager.v3.IEffectiveTag[] = + []; + const iterable = client.listEffectiveTagsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listEffectiveTags.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + + it('uses async iteration with listEffectiveTags with error', async () => { + const client = new tagbindingsModule.v3.TagBindingsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListEffectiveTagsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listEffectiveTags.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEffectiveTagsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.resourcemanager.v3.IEffectiveTag[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listEffectiveTags.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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 tagbindingsModule.v3.TagBindingsClient({ + 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('folder', () => { const fakePath = '/rendered/path/folder'; @@ -977,6 +1519,55 @@ describe('v3.TagBindingsClient', () => { }); }); + describe('tagHold', () => { + const fakePath = '/rendered/path/tagHold'; + const expectedParameters = { + tag_value: 'tagValueValue', + tag_hold: 'tagHoldValue', + }; + const client = new tagbindingsModule.v3.TagBindingsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagHoldPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagHoldPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagHoldPath', () => { + const result = client.tagHoldPath('tagValueValue', 'tagHoldValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagHoldPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagValueFromTagHoldName', () => { + const result = client.matchTagValueFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagValueValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTagHoldFromTagHoldName', () => { + const result = client.matchTagHoldFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagHoldValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('tagKey', () => { const fakePath = '/rendered/path/tagKey'; const expectedParameters = { diff --git a/packages/google-cloud-resourcemanager/test/gapic_tag_holds_v3.ts b/packages/google-cloud-resourcemanager/test/gapic_tag_holds_v3.ts new file mode 100644 index 000000000000..7c035766d917 --- /dev/null +++ b/packages/google-cloud-resourcemanager/test/gapic_tag_holds_v3.ts @@ -0,0 +1,1558 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +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 * as tagholdsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + 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 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 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({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + 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); +} + +describe('v3.TagHoldsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = tagholdsModule.v3.TagHoldsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tagholdsModule.v3.TagHoldsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tagholdsModule.v3.TagHoldsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new tagholdsModule.v3.TagHoldsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tagHoldsStub, undefined); + await client.initialize(); + assert(client.tagHoldsStub); + }); + + it('has close method for the initialized client', done => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.tagHoldsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tagHoldsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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('createTagHold', () => { + it('invokes createTagHold without error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.CreateTagHoldRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.CreateTagHoldRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createTagHold = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createTagHold(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTagHold as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTagHold as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTagHold without error using callback', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.CreateTagHoldRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.CreateTagHoldRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createTagHold = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTagHold( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.resourcemanager.v3.ITagHold, + protos.google.cloud.resourcemanager.v3.ICreateTagHoldMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.resourcemanager.v3.ITagHold, + protos.google.cloud.resourcemanager.v3.ICreateTagHoldMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTagHold as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTagHold as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTagHold with call error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.CreateTagHoldRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.CreateTagHoldRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTagHold = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createTagHold(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createTagHold as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTagHold as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createTagHold with LRO error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.CreateTagHoldRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.CreateTagHoldRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTagHold = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createTagHold(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createTagHold as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTagHold as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateTagHoldProgress without error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + 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.checkCreateTagHoldProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateTagHoldProgress with error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + 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.checkCreateTagHoldProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteTagHold', () => { + it('invokes deleteTagHold without error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.DeleteTagHoldRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.DeleteTagHoldRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteTagHold = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteTagHold(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteTagHold as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTagHold as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTagHold without error using callback', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.DeleteTagHoldRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.DeleteTagHoldRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteTagHold = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTagHold( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.resourcemanager.v3.IDeleteTagHoldMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteTagHold as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTagHold as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTagHold with call error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.DeleteTagHoldRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.DeleteTagHoldRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTagHold = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteTagHold(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteTagHold as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTagHold as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTagHold with LRO error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.DeleteTagHoldRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.DeleteTagHoldRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTagHold = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteTagHold(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteTagHold as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTagHold as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteTagHoldProgress without error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + 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.checkDeleteTagHoldProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteTagHoldProgress with error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + 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.checkDeleteTagHoldProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listTagHolds', () => { + it('invokes listTagHolds without error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListTagHoldsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.ListTagHoldsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + ]; + client.innerApiCalls.listTagHolds = stubSimpleCall(expectedResponse); + const [response] = await client.listTagHolds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTagHolds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTagHolds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTagHolds without error using callback', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListTagHoldsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.ListTagHoldsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + ]; + client.innerApiCalls.listTagHolds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTagHolds( + request, + ( + err?: Error | null, + result?: protos.google.cloud.resourcemanager.v3.ITagHold[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTagHolds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTagHolds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTagHolds with error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListTagHoldsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.ListTagHoldsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listTagHolds = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listTagHolds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listTagHolds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTagHolds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTagHoldsStream without error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListTagHoldsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.ListTagHoldsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + ]; + client.descriptors.page.listTagHolds.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listTagHoldsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.resourcemanager.v3.TagHold[] = []; + stream.on( + 'data', + (response: protos.google.cloud.resourcemanager.v3.TagHold) => { + 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.listTagHolds.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTagHolds, request) + ); + assert( + (client.descriptors.page.listTagHolds.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listTagHoldsStream with error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListTagHoldsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.ListTagHoldsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTagHolds.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listTagHoldsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.resourcemanager.v3.TagHold[] = []; + stream.on( + 'data', + (response: protos.google.cloud.resourcemanager.v3.TagHold) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listTagHolds.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTagHolds, request) + ); + assert( + (client.descriptors.page.listTagHolds.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTagHolds without error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListTagHoldsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.ListTagHoldsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagHold() + ), + ]; + client.descriptors.page.listTagHolds.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.resourcemanager.v3.ITagHold[] = []; + const iterable = client.listTagHoldsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listTagHolds.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listTagHolds.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTagHolds with error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.ListTagHoldsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.resourcemanager.v3.ListTagHoldsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTagHolds.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTagHoldsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.resourcemanager.v3.ITagHold[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listTagHolds.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listTagHolds.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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 tagholdsModule.v3.TagHoldsClient({ + 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('folder', () => { + const fakePath = '/rendered/path/folder'; + const expectedParameters = { + folder: 'folderValue', + }; + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderPath', () => { + const result = client.folderPath('folderValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderName', () => { + const result = client.matchFolderFromFolderName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organization', () => { + const fakePath = '/rendered/path/organization'; + const expectedParameters = { + organization: 'organizationValue', + }; + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath('organizationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + (client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new tagholdsModule.v3.TagHoldsClient({ + 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('tagBinding', () => { + const fakePath = '/rendered/path/tagBinding'; + const expectedParameters = { + tag_binding: 'tagBindingValue', + }; + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagBindingPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagBindingPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagBindingPath', () => { + const result = client.tagBindingPath('tagBindingValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagBindingPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagBindingFromTagBindingName', () => { + const result = client.matchTagBindingFromTagBindingName(fakePath); + assert.strictEqual(result, 'tagBindingValue'); + assert( + (client.pathTemplates.tagBindingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('tagHold', () => { + const fakePath = '/rendered/path/tagHold'; + const expectedParameters = { + tag_value: 'tagValueValue', + tag_hold: 'tagHoldValue', + }; + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagHoldPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagHoldPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagHoldPath', () => { + const result = client.tagHoldPath('tagValueValue', 'tagHoldValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagHoldPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagValueFromTagHoldName', () => { + const result = client.matchTagValueFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagValueValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTagHoldFromTagHoldName', () => { + const result = client.matchTagHoldFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagHoldValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('tagKey', () => { + const fakePath = '/rendered/path/tagKey'; + const expectedParameters = { + tag_key: 'tagKeyValue', + }; + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagKeyPath', () => { + const result = client.tagKeyPath('tagKeyValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagKeyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagKeyFromTagKeyName', () => { + const result = client.matchTagKeyFromTagKeyName(fakePath); + assert.strictEqual(result, 'tagKeyValue'); + assert( + (client.pathTemplates.tagKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('tagValue', () => { + const fakePath = '/rendered/path/tagValue'; + const expectedParameters = { + tag_value: 'tagValueValue', + }; + const client = new tagholdsModule.v3.TagHoldsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagValuePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagValuePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagValuePath', () => { + const result = client.tagValuePath('tagValueValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagValuePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagValueFromTagValueName', () => { + const result = client.matchTagValueFromTagValueName(fakePath); + assert.strictEqual(result, 'tagValueValue'); + assert( + (client.pathTemplates.tagValuePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-resourcemanager/test/gapic_tag_keys_v3.ts b/packages/google-cloud-resourcemanager/test/gapic_tag_keys_v3.ts index d17d5c8fd6bb..bc9ff20c9ba1 100644 --- a/packages/google-cloud-resourcemanager/test/gapic_tag_keys_v3.ts +++ b/packages/google-cloud-resourcemanager/test/gapic_tag_keys_v3.ts @@ -384,6 +384,90 @@ describe('v3.TagKeysClient', () => { }); }); + describe('getNamespacedTagKey', () => { + it('invokes getNamespacedTagKey without error', async () => { + const client = new tagkeysModule.v3.TagKeysClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagKey() + ); + client.innerApiCalls.getNamespacedTagKey = + stubSimpleCall(expectedResponse); + const [response] = await client.getNamespacedTagKey(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes getNamespacedTagKey without error using callback', async () => { + const client = new tagkeysModule.v3.TagKeysClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagKey() + ); + client.innerApiCalls.getNamespacedTagKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNamespacedTagKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.resourcemanager.v3.ITagKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes getNamespacedTagKey with error', async () => { + const client = new tagkeysModule.v3.TagKeysClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.getNamespacedTagKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getNamespacedTagKey(request), expectedError); + }); + + it('invokes getNamespacedTagKey with closed client', async () => { + const client = new tagkeysModule.v3.TagKeysClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNamespacedTagKey(request), expectedError); + }); + }); + describe('getIamPolicy', () => { it('invokes getIamPolicy without error', async () => { const client = new tagkeysModule.v3.TagKeysClient({ @@ -1527,6 +1611,311 @@ describe('v3.TagKeysClient', () => { ); }); }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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 tagkeysModule.v3.TagKeysClient({ + 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('folder', () => { @@ -1681,6 +2070,55 @@ describe('v3.TagKeysClient', () => { }); }); + describe('tagHold', () => { + const fakePath = '/rendered/path/tagHold'; + const expectedParameters = { + tag_value: 'tagValueValue', + tag_hold: 'tagHoldValue', + }; + const client = new tagkeysModule.v3.TagKeysClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagHoldPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagHoldPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagHoldPath', () => { + const result = client.tagHoldPath('tagValueValue', 'tagHoldValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagHoldPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagValueFromTagHoldName', () => { + const result = client.matchTagValueFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagValueValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTagHoldFromTagHoldName', () => { + const result = client.matchTagHoldFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagHoldValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('tagKey', () => { const fakePath = '/rendered/path/tagKey'; const expectedParameters = { diff --git a/packages/google-cloud-resourcemanager/test/gapic_tag_values_v3.ts b/packages/google-cloud-resourcemanager/test/gapic_tag_values_v3.ts index 172a4c602e33..84ffe7a80c3f 100644 --- a/packages/google-cloud-resourcemanager/test/gapic_tag_values_v3.ts +++ b/packages/google-cloud-resourcemanager/test/gapic_tag_values_v3.ts @@ -387,6 +387,96 @@ describe('v3.TagValuesClient', () => { }); }); + describe('getNamespacedTagValue', () => { + it('invokes getNamespacedTagValue without error', async () => { + const client = new tagvaluesModule.v3.TagValuesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagValue() + ); + client.innerApiCalls.getNamespacedTagValue = + stubSimpleCall(expectedResponse); + const [response] = await client.getNamespacedTagValue(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes getNamespacedTagValue without error using callback', async () => { + const client = new tagvaluesModule.v3.TagValuesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.TagValue() + ); + client.innerApiCalls.getNamespacedTagValue = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNamespacedTagValue( + request, + ( + err?: Error | null, + result?: protos.google.cloud.resourcemanager.v3.ITagValue | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes getNamespacedTagValue with error', async () => { + const client = new tagvaluesModule.v3.TagValuesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.getNamespacedTagValue = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getNamespacedTagValue(request), + expectedError + ); + }); + + it('invokes getNamespacedTagValue with closed client', async () => { + const client = new tagvaluesModule.v3.TagValuesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getNamespacedTagValue(request), + expectedError + ); + }); + }); + describe('getIamPolicy', () => { it('invokes getIamPolicy without error', async () => { const client = new tagvaluesModule.v3.TagValuesClient({ @@ -1539,6 +1629,311 @@ describe('v3.TagValuesClient', () => { ); }); }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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 tagvaluesModule.v3.TagValuesClient({ + 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('folder', () => { @@ -1693,6 +2088,55 @@ describe('v3.TagValuesClient', () => { }); }); + describe('tagHold', () => { + const fakePath = '/rendered/path/tagHold'; + const expectedParameters = { + tag_value: 'tagValueValue', + tag_hold: 'tagHoldValue', + }; + const client = new tagvaluesModule.v3.TagValuesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tagHoldPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.tagHoldPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('tagHoldPath', () => { + const result = client.tagHoldPath('tagValueValue', 'tagHoldValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.tagHoldPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchTagValueFromTagHoldName', () => { + const result = client.matchTagValueFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagValueValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTagHoldFromTagHoldName', () => { + const result = client.matchTagHoldFromTagHoldName(fakePath); + assert.strictEqual(result, 'tagHoldValue'); + assert( + (client.pathTemplates.tagHoldPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('tagKey', () => { const fakePath = '/rendered/path/tagKey'; const expectedParameters = { diff --git a/packages/google-cloud-translate/protos/google/cloud/translate/v3/translation_service.proto b/packages/google-cloud-translate/protos/google/cloud/translate/v3/translation_service.proto index d5e93176aa7b..fab3467424fe 100644 --- a/packages/google-cloud-translate/protos/google/cloud/translate/v3/translation_service.proto +++ b/packages/google-cloud-translate/protos/google/cloud/translate/v3/translation_service.proto @@ -25,7 +25,7 @@ import "google/protobuf/timestamp.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Translate.V3"; -option go_package = "cloud.google.com/go/translation/apiv3/translationpb;translationpb"; +option go_package = "cloud.google.com/go/translate/apiv3/translatepb;translatepb"; option java_multiple_files = true; option java_outer_classname = "TranslationServiceProto"; option java_package = "com.google.cloud.translate.v3"; diff --git a/packages/google-cloud-translate/protos/protos.json b/packages/google-cloud-translate/protos/protos.json index ca4d12314474..ea7755ff0923 100644 --- a/packages/google-cloud-translate/protos/protos.json +++ b/packages/google-cloud-translate/protos/protos.json @@ -10,7 +10,7 @@ "options": { "cc_enable_arenas": true, "csharp_namespace": "Google.Cloud.Translate.V3", - "go_package": "cloud.google.com/go/translation/apiv3/translationpb;translationpb", + "go_package": "cloud.google.com/go/translate/apiv3/translatepb;translatepb", "java_multiple_files": true, "java_outer_classname": "TranslationServiceProto", "java_package": "com.google.cloud.translate.v3", diff --git a/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json b/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json index b7c5e765b169..40ca95d0f3a4 100644 --- a/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json +++ b/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-translation", - "version": "7.2.0", + "version": "7.2.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json b/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json index 8a2c6dbc95ba..ced937ad8b87 100644 --- a/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json +++ b/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-translation", - "version": "7.2.0", + "version": "7.2.1", "language": "TYPESCRIPT", "apis": [ {