From 5a28ea17a111add120afbd81949a5ca05a7dc96c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:21:07 +0000 Subject: [PATCH 1/2] feat: support regapic LRO Use gapic-generator-typescript v2.15.1. PiperOrigin-RevId: 456946341 Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 64 + .../v1/managed_identities_service.proto | 422 ++++ .../cloud/managedidentities/v1/resource.proto | 213 ++ ...managed_identities_service.attach_trust.js | 65 + ...ties_service.create_microsoft_ad_domain.js | 80 + ...anaged_identities_service.delete_domain.js | 60 + ...managed_identities_service.detach_trust.js | 65 + .../managed_identities_service.get_domain.js | 59 + ...managed_identities_service.list_domains.js | 87 + ...ed_identities_service.reconfigure_trust.js | 72 + ...identities_service.reset_admin_password.js | 59 + ...anaged_identities_service.update_domain.js | 70 + ...naged_identities_service.validate_trust.js | 65 + ...ata.google.cloud.managedidentities.v1.json | 463 +++++ owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 127 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../v1/managed_identities_service_client.ts | 1581 +++++++++++++++ ...aged_identities_service_client_config.json | 76 + ...managed_identities_service_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../gapic_managed_identities_service_v1.ts | 1744 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + owl-bot-staging/v1beta1/.eslintignore | 7 + owl-bot-staging/v1beta1/.eslintrc.json | 3 + owl-bot-staging/v1beta1/.gitignore | 14 + owl-bot-staging/v1beta1/.jsdoc.js | 55 + owl-bot-staging/v1beta1/.mocharc.js | 33 + owl-bot-staging/v1beta1/.prettierrc.js | 22 + owl-bot-staging/v1beta1/README.md | 1 + .../v1beta1/linkinator.config.json | 16 + owl-bot-staging/v1beta1/package.json | 64 + .../v1beta1/managed_identities_service.proto | 389 ++++ .../managedidentities/v1beta1/resource.proto | 217 ++ ...managed_identities_service.attach_trust.js | 65 + ...ties_service.create_microsoft_ad_domain.js | 79 + ...anaged_identities_service.delete_domain.js | 60 + ...managed_identities_service.detach_trust.js | 65 + .../managed_identities_service.get_domain.js | 59 + ...managed_identities_service.list_domains.js | 87 + ...ed_identities_service.reconfigure_trust.js | 72 + ...identities_service.reset_admin_password.js | 59 + ...anaged_identities_service.update_domain.js | 71 + ...naged_identities_service.validate_trust.js | 65 + ...oogle.cloud.managedidentities.v1beta1.json | 463 +++++ owl-bot-staging/v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 127 ++ owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 + .../managed_identities_service_client.ts | 1548 +++++++++++++++ ...aged_identities_service_client_config.json | 66 + ...managed_identities_service_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + ...apic_managed_identities_service_v1beta1.ts | 1744 +++++++++++++++++ owl-bot-staging/v1beta1/tsconfig.json | 19 + owl-bot-staging/v1beta1/webpack.config.js | 64 + 68 files changed, 11452 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/resource.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.attach_trust.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.delete_domain.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.detach_trust.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.get_domain.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.list_domains.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.update_domain.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.validate_trust.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.managedidentities.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/src/v1/managed_identities_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/managed_identities_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/managed_identities_service_proto_list.json create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_managed_identities_service_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js create mode 100644 owl-bot-staging/v1beta1/.eslintignore create mode 100644 owl-bot-staging/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1beta1/.gitignore create mode 100644 owl-bot-staging/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1beta1/README.md create mode 100644 owl-bot-staging/v1beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1beta1/package.json create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.managedidentities.v1beta1.json create mode 100644 owl-bot-staging/v1beta1/src/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client_config.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_proto_list.json create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1beta1/test/gapic_managed_identities_service_v1beta1.ts create mode 100644 owl-bot-staging/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..df287d2 --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/managed-identities', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..94f33d6 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Managedidentities: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..887d031 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/managed-identities", + "version": "0.1.0", + "description": "Managedidentities client for Node.js", + "repository": "googleapis/nodejs-managedidentities", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google managedidentities", + "managedidentities", + "managed identities service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto b/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto new file mode 100644 index 0000000..9112ac6 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto @@ -0,0 +1,422 @@ +// Copyright 2019 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.managedidentities.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/managedidentities/v1/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ManagedIdentities.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1;managedidentities"; +option java_multiple_files = true; +option java_outer_classname = "ManagedIdentitiesServiceProto"; +option java_package = "com.google.cloud.managedidentities.v1"; +option objc_class_prefix = "GCMI"; +option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1"; +option ruby_package = "Google::Cloud::ManagedIdentities::V1"; + +// API Overview +// +// The `managedidentites.googleapis.com` service implements the Google Cloud +// Managed Identites API for identity services +// (e.g. Microsoft Active Directory). +// +// The Managed Identities service provides methods to manage +// (create/read/update/delete) domains, reset managed identities admin password, +// add/remove domain controllers in GCP regions and add/remove VPC peering. +// +// Data Model +// +// The Managed Identities service exposes the following resources: +// +// * Locations as global, named as follows: +// `projects/{project_id}/locations/global`. +// +// * Domains, named as follows: +// `/projects/{project_id}/locations/global/domain/{domain_name}`. +// +// The `{domain_name}` refers to fully qualified domain name in the customer +// project e.g. mydomain.myorganization.com, with the following restrictions: +// +// * Must contain only lowercase letters, numbers, periods and hyphens. +// * Must start with a letter. +// * Must contain between 2-64 characters. +// * Must end with a number or a letter. +// * Must not start with period. +// * First segement length (mydomain form example above) shouldn't exceed +// 15 chars. +// * The last segment cannot be fully numeric. +// * Must be unique within the customer project. +service ManagedIdentitiesService { + option (google.api.default_host) = "managedidentities.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Microsoft AD domain. + rpc CreateMicrosoftAdDomain(CreateMicrosoftAdDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/global}/domains" + body: "domain" + }; + option (google.api.method_signature) = "parent,domain_name,domain"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Resets a domain's administrator password. + rpc ResetAdminPassword(ResetAdminPasswordRequest) returns (ResetAdminPasswordResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:resetAdminPassword" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Lists domains in a project. + rpc ListDomains(ListDomainsRequest) returns (ListDomainsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/global}/domains" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets information about a domain. + rpc GetDomain(GetDomainRequest) returns (Domain) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/global/domains/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the metadata and configuration of a domain. + rpc UpdateDomain(UpdateDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{domain.name=projects/*/locations/global/domains/*}" + body: "domain" + }; + option (google.api.method_signature) = "domain,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Deletes a domain. + rpc DeleteDomain(DeleteDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/global/domains/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OpMetadata" + }; + } + + // Adds an AD trust to a domain. + rpc AttachTrust(AttachTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:attachTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Updates the DNS conditional forwarder. + rpc ReconfigureTrust(ReconfigureTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:reconfigureTrust" + body: "*" + }; + option (google.api.method_signature) = "name,target_domain_name,target_dns_ip_addresses"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Removes an AD trust. + rpc DetachTrust(DetachTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:detachTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Validates a trust state, that the target domain is reachable, and that the + // target domain is able to accept incoming trust requests. + rpc ValidateTrust(ValidateTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/global/domains/*}:validateTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } +} + +// Represents the metadata of the long-running operation. +message OpMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for +// [CreateMicrosoftAdDomain][google.cloud.managedidentities.v1.CreateMicrosoftAdDomain] +message CreateMicrosoftAdDomainRequest { + // Required. The resource project name and location using the form: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The fully qualified domain name. + // e.g. mydomain.myorganization.com, with the following restrictions: + // + // * Must contain only lowercase letters, numbers, periods and hyphens. + // * Must start with a letter. + // * Must contain between 2-64 characters. + // * Must end with a number or a letter. + // * Must not start with period. + // * First segement length (mydomain form example above) shouldn't exceed + // 15 chars. + // * The last segment cannot be fully numeric. + // * Must be unique within the customer project. + string domain_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A Managed Identity domain resource. + Domain domain = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword] +message ResetAdminPasswordRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Response message for +// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword] +message ResetAdminPasswordResponse { + // A random password. See [admin][google.cloud.managedidentities.v1.Domain.admin] for more information. + string password = 1; +} + +// Request message for +// [ListDomains][google.cloud.managedidentities.v1.ListDomains] +message ListDomainsRequest { + // Required. The resource name of the domain location using the form: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Optional. The maximum number of items to return. + // If not specified, a default value of 1000 will be used. + // Regardless of the page_size value, the response may include a partial list. + // Callers should rely on a response's + // [next_page_token][google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token] + // to determine if there are additional results to list. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The `next_page_token` value returned from a previous ListDomainsRequest + // request, if any. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter specifying constraints of a list operation. + // For example, `Domain.fqdn="mydomain.myorginization"`. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the ordering of results. See + // [Sorting + // order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + // for more information. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [ListDomains][google.cloud.managedidentities.v1.ListDomains] +message ListDomainsResponse { + // A list of Managed Identities Service domains in the project. + repeated Domain domains = 1; + + // A token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; + + // A list of locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for [GetDomain][google.cloud.managedidentities.v1.GetDomain] +message GetDomainRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Request message for +// [UpdateDomain][google.cloud.managedidentities.v1.UpdateDomain] +message UpdateDomainRequest { + // Required. Mask of fields to update. At least one path must be supplied in this + // field. The elements of the repeated paths field may only include + // fields from [Domain][google.cloud.managedidentities.v1.Domain]: + // * `labels` + // * `locations` + // * `authorized_networks` + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Domain message with updated fields. Only supported fields specified in + // update_mask are updated. + Domain domain = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [DeleteDomain][google.cloud.managedidentities.v1.DeleteDomain] +message DeleteDomainRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Request message for +// [AttachTrust][google.cloud.managedidentities.v1.AttachTrust] +message AttachTrustRequest { + // Required. The resource domain name, project name and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust resource. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ReconfigureTrust][google.cloud.managedidentities.v1.ReconfigureTrust] +message ReconfigureTrustRequest { + // Required. The resource domain name, project name and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The fully-qualified target domain name which will be in trust with current + // domain. + string target_domain_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The target DNS server IP addresses to resolve the remote domain involved + // in the trust. + repeated string target_dns_ip_addresses = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [DetachTrust][google.cloud.managedidentities.v1.DetachTrust] +message DetachTrustRequest { + // Required. The resource domain name, project name, and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust resource to removed. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ValidateTrust][google.cloud.managedidentities.v1.ValidateTrust] +message ValidateTrustRequest { + // Required. The resource domain name, project name, and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust to validate trust state for. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/resource.proto b/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/resource.proto new file mode 100644 index 0000000..f1b5ae5 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/resource.proto @@ -0,0 +1,213 @@ +// Copyright 2019 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.managedidentities.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.ManagedIdentities.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1;managedidentities"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.cloud.managedidentities.v1"; +option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1"; +option ruby_package = "Google::Cloud::ManagedIdentities::V1"; + +// Represents a managed Microsoft Active Directory domain. +message Domain { + option (google.api.resource) = { + type: "managedidentities.googleapis.com/Domain" + pattern: "projects/{project}/locations/{location}/domains/{domain}" + }; + + // Represents the different states of a managed domain. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The domain is being created. + CREATING = 1; + + // The domain has been created and is fully usable. + READY = 2; + + // The domain's configuration is being updated. + UPDATING = 3; + + // The domain is being deleted. + DELETING = 4; + + // The domain is being repaired and may be unusable. Details + // can be found in the `status_message` field. + REPAIRING = 5; + + // The domain is undergoing maintenance. + PERFORMING_MAINTENANCE = 6; + + // The domain is not serving requests. + UNAVAILABLE = 7; + } + + // Required. The unique name of the domain using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Resource labels that can contain user-provided metadata. + map labels = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The full names of the Google Compute Engine + // [networks](/compute/docs/networks-and-firewalls#networks) the domain + // instance is connected to. Networks can be added using UpdateDomain. + // The domain is only available on networks listed in `authorized_networks`. + // If CIDR subnets overlap between networks, domain creation will fail. + repeated string authorized_networks = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The CIDR range of internal addresses that are reserved for this + // domain. Reserved networks must be /24 or larger. Ranges must be + // unique and non-overlapping with existing subnets in + // [Domain].[authorized_networks]. + string reserved_ip_range = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Locations where domain needs to be provisioned. + // [regions][compute/docs/regions-zones/] + // e.g. us-west1 or us-east4 + // Service supports up to 4 locations at once. Each location will use a /26 + // block. + repeated string locations = 5 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The name of delegated administrator account used to perform + // Active Directory operations. If not specified, `setupadmin` will be used. + string admin = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The fully-qualified domain name of the exposed domain used by + // clients to connect to the service. Similar to what would be chosen for an + // Active Directory set up on an internal network. + string fqdn = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of this domain. + State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current status of this + // domain, if available. + string status_message = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current trusts associated with the domain. + repeated Trust trusts = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a relationship between two domains. This allows a controller in +// one domain to authenticate a user in another domain. +message Trust { + // Represents the different states of a domain trust. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The domain trust is being created. + CREATING = 1; + + // The domain trust is being updated. + UPDATING = 2; + + // The domain trust is being deleted. + DELETING = 3; + + // The domain trust is connected. + CONNECTED = 4; + + // The domain trust is disconnected. + DISCONNECTED = 5; + } + + // Represents the different inter-forest trust types. + enum TrustType { + // Not set. + TRUST_TYPE_UNSPECIFIED = 0; + + // The forest trust. + FOREST = 1; + + // The external domain trust. + EXTERNAL = 2; + } + + // Represents the direction of trust. + // See + // [System.DirectoryServices.ActiveDirectory.TrustDirection](https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.trustdirection?view=netframework-4.7.2) + // for more information. + enum TrustDirection { + // Not set. + TRUST_DIRECTION_UNSPECIFIED = 0; + + // The inbound direction represents the trusting side. + INBOUND = 1; + + // The outboud direction represents the trusted side. + OUTBOUND = 2; + + // The bidirectional direction represents the trusted / trusting side. + BIDIRECTIONAL = 3; + } + + // Required. The fully qualified target domain name which will be in trust with the + // current domain. + string target_domain_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of trust represented by the trust resource. + TrustType trust_type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The trust direction, which decides if the current domain is trusted, + // trusting, or both. + TrustDirection trust_direction = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The trust authentication type, which decides whether the trusted side has + // forest/domain wide access or selective access to an approved set of + // resources. + bool selective_authentication = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The target DNS server IP addresses which can resolve the remote domain + // involved in the trust. + repeated string target_dns_ip_addresses = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. The trust secret used for the handshake with the target domain. This will + // not be stored. + string trust_handshake_secret = 6 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the trust. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the trust, if available. + string state_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last heartbeat time when the trust was known to be connected. + google.protobuf.Timestamp last_trust_heartbeat_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.attach_trust.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.attach_trust.js new file mode 100644 index 0000000..8157700 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.attach_trust.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, trust) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust resource. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callAttachTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.attachTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAttachTrust(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js new file mode 100644 index 0000000..d9d02d6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js @@ -0,0 +1,80 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, domainName, domain) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource project name and location using the form: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Required. The fully qualified domain name. + * e.g. mydomain.myorganization.com, with the following restrictions: + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segement length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + */ + // const domainName = 'abc123' + /** + * Required. A Managed Identity domain resource. + */ + // const domain = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callCreateMicrosoftAdDomain() { + // Construct request + const request = { + parent, + domainName, + domain, + }; + + // Run request + const [operation] = await managedidentitiesClient.createMicrosoftAdDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMicrosoftAdDomain(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.delete_domain.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.delete_domain.js new file mode 100644 index 0000000..1791a8d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.delete_domain.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callDeleteDomain() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await managedidentitiesClient.deleteDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteDomain(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.detach_trust.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.detach_trust.js new file mode 100644 index 0000000..d8867cb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.detach_trust.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, trust) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust resource to removed. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callDetachTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.detachTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDetachTrust(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.get_domain.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.get_domain.js new file mode 100644 index 0000000..8324929 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.get_domain.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callGetDomain() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await managedidentitiesClient.getDomain(request); + console.log(response); + } + + callGetDomain(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.list_domains.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.list_domains.js new file mode 100644 index 0000000..bdc9df4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.list_domains.js @@ -0,0 +1,87 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * next_page_token google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token + * to determine if there are additional results to list. + */ + // const pageSize = 1234 + /** + * Optional. The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + */ + // const pageToken = 'abc123' + /** + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results. See + * Sorting + * order (https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + */ + // const orderBy = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callListDomains() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await managedidentitiesClient.listDomainsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDomains(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js new file mode 100644 index 0000000..03efc16 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, targetDomainName, targetDnsIpAddresses) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The fully-qualified target domain name which will be in trust with current + * domain. + */ + // const targetDomainName = 'abc123' + /** + * Required. The target DNS server IP addresses to resolve the remote domain involved + * in the trust. + */ + // const targetDnsIpAddresses = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callReconfigureTrust() { + // Construct request + const request = { + name, + targetDomainName, + targetDnsIpAddresses, + }; + + // Run request + const [operation] = await managedidentitiesClient.reconfigureTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReconfigureTrust(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js new file mode 100644 index 0000000..22c87da --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callResetAdminPassword() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await managedidentitiesClient.resetAdminPassword(request); + console.log(response); + } + + callResetAdminPassword(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.update_domain.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.update_domain.js new file mode 100644 index 0000000..565b63c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.update_domain.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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(updateMask, domain) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include + * fields from Domain google.cloud.managedidentities.v1.Domain: + * * `labels` + * * `locations` + * * `authorized_networks` + */ + // const updateMask = {} + /** + * Required. Domain message with updated fields. Only supported fields specified in + * update_mask are updated. + */ + // const domain = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callUpdateDomain() { + // Construct request + const request = { + updateMask, + domain, + }; + + // Run request + const [operation] = await managedidentitiesClient.updateDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateDomain(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.validate_trust.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.validate_trust.js new file mode 100644 index 0000000..e59267a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.validate_trust.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, trust) { + // [START managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust to validate trust state for. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callValidateTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.validateTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callValidateTrust(); + // [END managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.managedidentities.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.managedidentities.v1.json new file mode 100644 index 0000000..d57a3a0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.managedidentities.v1.json @@ -0,0 +1,463 @@ +{ + "clientLibrary": { + "name": "nodejs-managedidentities", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.managedidentities.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async", + "title": "ManagedIdentitiesService createMicrosoftAdDomain Sample", + "origin": "API_DEFINITION", + "description": " Creates a Microsoft AD domain.", + "canonical": true, + "file": "managed_identities_service.create_microsoft_ad_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMicrosoftAdDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.CreateMicrosoftAdDomain", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "domain_name", + "type": "TYPE_STRING" + }, + { + "name": "domain", + "type": ".google.cloud.managedidentities.v1.Domain" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "CreateMicrosoftAdDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.CreateMicrosoftAdDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async", + "title": "ManagedIdentitiesService resetAdminPassword Sample", + "origin": "API_DEFINITION", + "description": " Resets a domain's administrator password.", + "canonical": true, + "file": "managed_identities_service.reset_admin_password.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetAdminPassword", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ResetAdminPassword", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1.ResetAdminPasswordResponse", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ResetAdminPassword", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ResetAdminPassword", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async", + "title": "ManagedIdentitiesService listDomains Sample", + "origin": "API_DEFINITION", + "description": " Lists domains in a project.", + "canonical": true, + "file": "managed_identities_service.list_domains.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDomains", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ListDomains", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1.ListDomainsResponse", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ListDomains", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ListDomains", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async", + "title": "ManagedIdentitiesService getDomain Sample", + "origin": "API_DEFINITION", + "description": " Gets information about a domain.", + "canonical": true, + "file": "managed_identities_service.get_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.GetDomain", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1.Domain", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "GetDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.GetDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async", + "title": "ManagedIdentitiesService updateDomain Sample", + "origin": "API_DEFINITION", + "description": " Updates the metadata and configuration of a domain.", + "canonical": true, + "file": "managed_identities_service.update_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.UpdateDomain", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "domain", + "type": ".google.cloud.managedidentities.v1.Domain" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "UpdateDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.UpdateDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async", + "title": "ManagedIdentitiesService deleteDomain Sample", + "origin": "API_DEFINITION", + "description": " Deletes a domain.", + "canonical": true, + "file": "managed_identities_service.delete_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DeleteDomain", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "DeleteDomain", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DeleteDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async", + "title": "ManagedIdentitiesService attachTrust Sample", + "origin": "API_DEFINITION", + "description": " Adds an AD trust to a domain.", + "canonical": true, + "file": "managed_identities_service.attach_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AttachTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.AttachTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "AttachTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.AttachTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async", + "title": "ManagedIdentitiesService reconfigureTrust Sample", + "origin": "API_DEFINITION", + "description": " Updates the DNS conditional forwarder.", + "canonical": true, + "file": "managed_identities_service.reconfigure_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReconfigureTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ReconfigureTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "target_domain_name", + "type": "TYPE_STRING" + }, + { + "name": "target_dns_ip_addresses", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ReconfigureTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ReconfigureTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async", + "title": "ManagedIdentitiesService detachTrust Sample", + "origin": "API_DEFINITION", + "description": " Removes an AD trust.", + "canonical": true, + "file": "managed_identities_service.detach_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetachTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DetachTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "DetachTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DetachTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async", + "title": "ManagedIdentitiesService validateTrust Sample", + "origin": "API_DEFINITION", + "description": " Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.", + "canonical": true, + "file": "managed_identities_service.validate_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ValidateTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ValidateTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ValidateTrust", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ValidateTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..89968bc --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 v1 from './v1'; +const ManagedIdentitiesServiceClient = v1.ManagedIdentitiesServiceClient; +type ManagedIdentitiesServiceClient = v1.ManagedIdentitiesServiceClient; +export {v1, ManagedIdentitiesServiceClient}; +export default {v1, ManagedIdentitiesServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..f9a5a08 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,127 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.managedidentities.v1", + "libraryPackage": "@google-cloud/managed-identities", + "services": { + "ManagedIdentitiesService": { + "clients": { + "grpc": { + "libraryClient": "ManagedIdentitiesServiceClient", + "rpcs": { + "ResetAdminPassword": { + "methods": [ + "resetAdminPassword" + ] + }, + "GetDomain": { + "methods": [ + "getDomain" + ] + }, + "CreateMicrosoftAdDomain": { + "methods": [ + "createMicrosoftAdDomain" + ] + }, + "UpdateDomain": { + "methods": [ + "updateDomain" + ] + }, + "DeleteDomain": { + "methods": [ + "deleteDomain" + ] + }, + "AttachTrust": { + "methods": [ + "attachTrust" + ] + }, + "ReconfigureTrust": { + "methods": [ + "reconfigureTrust" + ] + }, + "DetachTrust": { + "methods": [ + "detachTrust" + ] + }, + "ValidateTrust": { + "methods": [ + "validateTrust" + ] + }, + "ListDomains": { + "methods": [ + "listDomains", + "listDomainsStream", + "listDomainsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ManagedIdentitiesServiceClient", + "rpcs": { + "ResetAdminPassword": { + "methods": [ + "resetAdminPassword" + ] + }, + "GetDomain": { + "methods": [ + "getDomain" + ] + }, + "CreateMicrosoftAdDomain": { + "methods": [ + "createMicrosoftAdDomain" + ] + }, + "UpdateDomain": { + "methods": [ + "updateDomain" + ] + }, + "DeleteDomain": { + "methods": [ + "deleteDomain" + ] + }, + "AttachTrust": { + "methods": [ + "attachTrust" + ] + }, + "ReconfigureTrust": { + "methods": [ + "reconfigureTrust" + ] + }, + "DetachTrust": { + "methods": [ + "detachTrust" + ] + }, + "ValidateTrust": { + "methods": [ + "validateTrust" + ] + }, + "ListDomains": { + "methods": [ + "listDomains", + "listDomainsStream", + "listDomainsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..a6d30bc --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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. ** + +export {ManagedIdentitiesServiceClient} from './managed_identities_service_client'; diff --git a/owl-bot-staging/v1/src/v1/managed_identities_service_client.ts b/owl-bot-staging/v1/src/v1/managed_identities_service_client.ts new file mode 100644 index 0000000..8d03b92 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/managed_identities_service_client.ts @@ -0,0 +1,1581 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/managed_identities_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './managed_identities_service_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * API Overview + * + * The `managedidentites.googleapis.com` service implements the Google Cloud + * Managed Identites API for identity services + * (e.g. Microsoft Active Directory). + * + * The Managed Identities service provides methods to manage + * (create/read/update/delete) domains, reset managed identities admin password, + * add/remove domain controllers in GCP regions and add/remove VPC peering. + * + * Data Model + * + * The Managed Identities service exposes the following resources: + * + * * Locations as global, named as follows: + * `projects/{project_id}/locations/global`. + * + * * Domains, named as follows: + * `/projects/{project_id}/locations/global/domain/{domain_name}`. + * + * The `{domain_name}` refers to fully qualified domain name in the customer + * project e.g. mydomain.myorganization.com, with the following restrictions: + * + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segement length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + * @class + * @memberof v1 + */ +export class ManagedIdentitiesServiceClient { + 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; + managedIdentitiesServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ManagedIdentitiesServiceClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ManagedIdentitiesServiceClient; + 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); + + // 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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 = { + domainPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/domains/{domain}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listDomains: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'domains') + }; + + 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.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/domains/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/domains/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/domains/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/global/operations}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const createMicrosoftAdDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const updateDomainResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const updateDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const deleteDomainResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const attachTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const attachTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const reconfigureTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const reconfigureTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const detachTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const detachTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + const validateTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; + const validateTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createMicrosoftAdDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMicrosoftAdDomainResponse.decode.bind(createMicrosoftAdDomainResponse), + createMicrosoftAdDomainMetadata.decode.bind(createMicrosoftAdDomainMetadata)), + updateDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateDomainResponse.decode.bind(updateDomainResponse), + updateDomainMetadata.decode.bind(updateDomainMetadata)), + deleteDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteDomainResponse.decode.bind(deleteDomainResponse), + deleteDomainMetadata.decode.bind(deleteDomainMetadata)), + attachTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + attachTrustResponse.decode.bind(attachTrustResponse), + attachTrustMetadata.decode.bind(attachTrustMetadata)), + reconfigureTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reconfigureTrustResponse.decode.bind(reconfigureTrustResponse), + reconfigureTrustMetadata.decode.bind(reconfigureTrustMetadata)), + detachTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + detachTrustResponse.decode.bind(detachTrustResponse), + detachTrustMetadata.decode.bind(detachTrustMetadata)), + validateTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + validateTrustResponse.decode.bind(validateTrustResponse), + validateTrustMetadata.decode.bind(validateTrustMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.managedidentities.v1.ManagedIdentitiesService', 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 = gax.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.managedIdentitiesServiceStub) { + return this.managedIdentitiesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.managedidentities.v1.ManagedIdentitiesService. + this.managedIdentitiesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.managedidentities.v1.ManagedIdentitiesService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.managedidentities.v1.ManagedIdentitiesService, + 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 managedIdentitiesServiceStubMethods = + ['createMicrosoftAdDomain', 'resetAdminPassword', 'listDomains', 'getDomain', 'updateDomain', 'deleteDomain', 'attachTrust', 'reconfigureTrust', 'detachTrust', 'validateTrust']; + for (const methodName of managedIdentitiesServiceStubMethods) { + const callPromise = this.managedIdentitiesServiceStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.managedIdentitiesServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'managedidentities.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 'managedidentities.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' + ]; + } + + 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 -- + // ------------------- +/** + * Resets a domain's administrator password. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @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 [ResetAdminPasswordResponse]{@link google.cloud.managedidentities.v1.ResetAdminPasswordResponse}. + * 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/v1/managed_identities_service.reset_admin_password.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async + */ + resetAdminPassword( + request?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|undefined, {}|undefined + ]>; + resetAdminPassword( + request: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): void; + resetAdminPassword( + request: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, + callback: Callback< + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): void; + resetAdminPassword( + request?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.resetAdminPassword(request, options, callback); + } +/** + * Gets information about a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @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 [Domain]{@link google.cloud.managedidentities.v1.Domain}. + * 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/v1/managed_identities_service.get_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async + */ + getDomain( + request?: protos.google.cloud.managedidentities.v1.IGetDomainRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|undefined, {}|undefined + ]>; + getDomain( + request: protos.google.cloud.managedidentities.v1.IGetDomainRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, + {}|null|undefined>): void; + getDomain( + request: protos.google.cloud.managedidentities.v1.IGetDomainRequest, + callback: Callback< + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, + {}|null|undefined>): void; + getDomain( + request?: protos.google.cloud.managedidentities.v1.IGetDomainRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.managedidentities.v1.IDomain, + protos.google.cloud.managedidentities.v1.IGetDomainRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getDomain(request, options, callback); + } + +/** + * Creates a Microsoft AD domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource project name and location using the form: + * `projects/{project_id}/locations/global` + * @param {string} request.domainName + * Required. The fully qualified domain name. + * e.g. mydomain.myorganization.com, with the following restrictions: + * + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segement length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + * @param {google.cloud.managedidentities.v1.Domain} request.domain + * Required. A Managed Identity domain resource. + * @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/v1/managed_identities_service.create_microsoft_ad_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async + */ + createMicrosoftAdDomain( + request?: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMicrosoftAdDomain( + request: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMicrosoftAdDomain( + request: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMicrosoftAdDomain( + request?: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createMicrosoftAdDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMicrosoftAdDomain()`. + * @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/v1/managed_identities_service.create_microsoft_ad_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async + */ + async checkCreateMicrosoftAdDomainProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createMicrosoftAdDomain, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the metadata and configuration of a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include + * fields from {@link google.cloud.managedidentities.v1.Domain|Domain}: + * * `labels` + * * `locations` + * * `authorized_networks` + * @param {google.cloud.managedidentities.v1.Domain} request.domain + * Required. Domain message with updated fields. Only supported fields specified in + * update_mask are updated. + * @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/v1/managed_identities_service.update_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async + */ + updateDomain( + request?: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateDomain( + request: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDomain( + request: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDomain( + request?: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'domain.name': request.domain!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateDomain()`. + * @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/v1/managed_identities_service.update_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async + */ + async checkUpdateDomainProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateDomain, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @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/v1/managed_identities_service.delete_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async + */ + deleteDomain( + request?: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteDomain( + request: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDomain( + request: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDomain( + request?: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteDomain()`. + * @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/v1/managed_identities_service.delete_domain.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async + */ + async checkDeleteDomainProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteDomain, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Adds an AD trust to a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1.Trust} request.trust + * Required. The domain trust resource. + * @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/v1/managed_identities_service.attach_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async + */ + attachTrust( + request?: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + attachTrust( + request: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + attachTrust( + request: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + attachTrust( + request?: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.attachTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `attachTrust()`. + * @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/v1/managed_identities_service.attach_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async + */ + async checkAttachTrustProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.attachTrust, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the DNS conditional forwarder. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {string} request.targetDomainName + * Required. The fully-qualified target domain name which will be in trust with current + * domain. + * @param {string[]} request.targetDnsIpAddresses + * Required. The target DNS server IP addresses to resolve the remote domain involved + * in the trust. + * @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/v1/managed_identities_service.reconfigure_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async + */ + reconfigureTrust( + request?: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + reconfigureTrust( + request: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reconfigureTrust( + request: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reconfigureTrust( + request?: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.reconfigureTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `reconfigureTrust()`. + * @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/v1/managed_identities_service.reconfigure_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async + */ + async checkReconfigureTrustProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.reconfigureTrust, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes an AD trust. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1.Trust} request.trust + * Required. The domain trust resource to removed. + * @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/v1/managed_identities_service.detach_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async + */ + detachTrust( + request?: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + detachTrust( + request: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + detachTrust( + request: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + detachTrust( + request?: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.detachTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `detachTrust()`. + * @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/v1/managed_identities_service.detach_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async + */ + async checkDetachTrustProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.detachTrust, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Validates a trust state, that the target domain is reachable, and that the + * target domain is able to accept incoming trust requests. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1.Trust} request.trust + * Required. The domain trust to validate trust state for. + * @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/v1/managed_identities_service.validate_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async + */ + validateTrust( + request?: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + validateTrust( + request: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateTrust( + request: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateTrust( + request?: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.validateTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `validateTrust()`. + * @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/v1/managed_identities_service.validate_trust.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async + */ + async checkValidateTrustProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.validateTrust, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists domains in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} [request.filter] + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} [request.orderBy] + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 [Domain]{@link google.cloud.managedidentities.v1.Domain}. + * 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 `listDomainsAsync()` + * 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. + */ + listDomains( + request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1.IDomain[], + protos.google.cloud.managedidentities.v1.IListDomainsRequest|null, + protos.google.cloud.managedidentities.v1.IListDomainsResponse + ]>; + listDomains( + request: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.managedidentities.v1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1.IDomain>): void; + listDomains( + request: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + callback: PaginationCallback< + protos.google.cloud.managedidentities.v1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1.IDomain>): void; + listDomains( + request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.managedidentities.v1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1.IDomain>, + callback?: PaginationCallback< + protos.google.cloud.managedidentities.v1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1.IDomain>): + Promise<[ + protos.google.cloud.managedidentities.v1.IDomain[], + protos.google.cloud.managedidentities.v1.IListDomainsRequest|null, + protos.google.cloud.managedidentities.v1.IListDomainsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listDomains(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 domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} [request.filter] + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} [request.orderBy] + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 [Domain]{@link google.cloud.managedidentities.v1.Domain} 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 `listDomainsAsync()` + * 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. + */ + listDomainsStream( + request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listDomains']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDomains.createStream( + this.innerApiCalls.listDomains as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDomains`, 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 domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} [request.filter] + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} [request.orderBy] + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 + * [Domain]{@link google.cloud.managedidentities.v1.Domain}. 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/v1/managed_identities_service.list_domains.js + * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async + */ + listDomainsAsync( + request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listDomains']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDomains.asyncIterate( + this.innerApiCalls['listDomains'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified domain resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} domain + * @returns {string} Resource name string. + */ + domainPath(project:string,location:string,domain:string) { + return this.pathTemplates.domainPathTemplate.render({ + project: project, + location: location, + domain: domain, + }); + } + + /** + * Parse the project from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).project; + } + + /** + * Parse the location from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).location; + } + + /** + * Parse the domain from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the domain. + */ + matchDomainFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).domain; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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; + } + + /** + * 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.managedIdentitiesServiceStub && !this._terminated) { + return this.managedIdentitiesServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/managed_identities_service_client_config.json b/owl-bot-staging/v1/src/v1/managed_identities_service_client_config.json new file mode 100644 index 0000000..96889cb --- /dev/null +++ b/owl-bot-staging/v1/src/v1/managed_identities_service_client_config.json @@ -0,0 +1,76 @@ +{ + "interfaces": { + "google.cloud.managedidentities.v1.ManagedIdentitiesService": { + "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": { + "CreateMicrosoftAdDomain": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetAdminPassword": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListDomains": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDomain": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDomain": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDomain": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AttachTrust": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReconfigureTrust": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DetachTrust": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ValidateTrust": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/managed_identities_service_proto_list.json b/owl-bot-staging/v1/src/v1/managed_identities_service_proto_list.json new file mode 100644 index 0000000..6200ede --- /dev/null +++ b/owl-bot-staging/v1/src/v1/managed_identities_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/managedidentities/v1/managed_identities_service.proto", + "../../protos/google/cloud/managedidentities/v1/resource.proto" +] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..026805f --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const managedidentities = require('@google-cloud/managed-identities'); + +function main() { + const managedIdentitiesServiceClient = new managedidentities.ManagedIdentitiesServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..041ef62 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 {ManagedIdentitiesServiceClient} from '@google-cloud/managed-identities'; + +// check that the client class type name can be used +function doStuffWithManagedIdentitiesServiceClient(client: ManagedIdentitiesServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const managedIdentitiesServiceClient = new ManagedIdentitiesServiceClient(); + doStuffWithManagedIdentitiesServiceClient(managedIdentitiesServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_managed_identities_service_v1.ts b/owl-bot-staging/v1/test/gapic_managed_identities_service_v1.ts new file mode 100644 index 0000000..0b1ab16 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_managed_identities_service_v1.ts @@ -0,0 +1,1744 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentitiesserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +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('v1.ManagedIdentitiesServiceClient', () => { + it('has servicePath', () => { + const servicePath = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.managedIdentitiesServiceStub, undefined); + await client.initialize(); + assert(client.managedIdentitiesServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.managedIdentitiesServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.managedIdentitiesServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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 managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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('resetAdminPassword', () => { + it('invokes resetAdminPassword without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse()); + client.innerApiCalls.resetAdminPassword = stubSimpleCall(expectedResponse); + const [response] = await client.resetAdminPassword(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes resetAdminPassword without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse()); + client.innerApiCalls.resetAdminPassword = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetAdminPassword( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes resetAdminPassword with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.resetAdminPassword = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.resetAdminPassword(request), expectedError); + assert((client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes resetAdminPassword with closed client', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.resetAdminPassword(request), expectedError); + }); + }); + + describe('getDomain', () => { + it('invokes getDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.GetDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()); + client.innerApiCalls.getDomain = stubSimpleCall(expectedResponse); + const [response] = await client.getDomain(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.GetDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()); + client.innerApiCalls.getDomain = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDomain( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IDomain|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getDomain with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.GetDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getDomain = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDomain(request), expectedError); + assert((client.innerApiCalls.getDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getDomain with closed client', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.GetDomainRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDomain(request), expectedError); + }); + }); + + describe('createMicrosoftAdDomain', () => { + it('invokes createMicrosoftAdDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMicrosoftAdDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createMicrosoftAdDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMicrosoftAdDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createMicrosoftAdDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMicrosoftAdDomain(request), expectedError); + assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createMicrosoftAdDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMicrosoftAdDomain(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateMicrosoftAdDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkCreateMicrosoftAdDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMicrosoftAdDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkCreateMicrosoftAdDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateDomain', () => { + it('invokes updateDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.UpdateDomainRequest()); + request.domain = {}; + request.domain.name = ''; + const expectedHeaderRequestParams = "domain.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.UpdateDomainRequest()); + request.domain = {}; + request.domain.name = ''; + const expectedHeaderRequestParams = "domain.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.UpdateDomainRequest()); + request.domain = {}; + request.domain.name = ''; + const expectedHeaderRequestParams = "domain.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateDomain(request), expectedError); + assert((client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.UpdateDomainRequest()); + request.domain = {}; + request.domain.name = ''; + const expectedHeaderRequestParams = "domain.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateDomain(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkUpdateDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkUpdateDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteDomain', () => { + it('invokes deleteDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DeleteDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DeleteDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DeleteDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteDomain(request), expectedError); + assert((client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DeleteDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteDomain(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkDeleteDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkDeleteDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('attachTrust', () => { + it('invokes attachTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.AttachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.attachTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.attachTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes attachTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.AttachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.attachTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.attachTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes attachTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.AttachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.attachTrust(request), expectedError); + assert((client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes attachTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.AttachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.attachTrust(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkAttachTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkAttachTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAttachTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkAttachTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('reconfigureTrust', () => { + it('invokes reconfigureTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.reconfigureTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes reconfigureTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.reconfigureTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reconfigureTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes reconfigureTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.reconfigureTrust(request), expectedError); + assert((client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes reconfigureTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.reconfigureTrust(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkReconfigureTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkReconfigureTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReconfigureTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkReconfigureTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('detachTrust', () => { + it('invokes detachTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DetachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.detachTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.detachTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes detachTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DetachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.detachTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detachTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes detachTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DetachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.detachTrust(request), expectedError); + assert((client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes detachTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DetachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.detachTrust(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDetachTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkDetachTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDetachTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkDetachTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('validateTrust', () => { + it('invokes validateTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ValidateTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.validateTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.validateTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes validateTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ValidateTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.validateTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.validateTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes validateTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ValidateTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.validateTrust(request), expectedError); + assert((client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes validateTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ValidateTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.validateTrust(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkValidateTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkValidateTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkValidateTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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.checkValidateTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listDomains', () => { + it('invokes listDomains without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + ]; + client.innerApiCalls.listDomains = stubSimpleCall(expectedResponse); + const [response] = await client.listDomains(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listDomains as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listDomains without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + ]; + client.innerApiCalls.listDomains = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDomains( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IDomain[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listDomains as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listDomains with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listDomains = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDomains(request), expectedError); + assert((client.innerApiCalls.listDomains as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listDomainsStream without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + ]; + client.descriptors.page.listDomains.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDomainsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.managedidentities.v1.Domain[] = []; + stream.on('data', (response: protos.google.cloud.managedidentities.v1.Domain) => { + 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.listDomains.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); + assert.strictEqual( + (client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listDomainsStream with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listDomains.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDomainsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.managedidentities.v1.Domain[] = []; + stream.on('data', (response: protos.google.cloud.managedidentities.v1.Domain) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); + assert.strictEqual( + (client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listDomains without error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), + ]; + client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.managedidentities.v1.IDomain[] = []; + const iterable = client.listDomainsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listDomains with error', async () => { + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDomainsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.managedidentities.v1.IDomain[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('domain', () => { + const fakePath = "/rendered/path/domain"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + domain: "domainValue", + }; + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.domainPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.domainPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('domainPath', () => { + const result = client.domainPath("projectValue", "locationValue", "domainValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.domainPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDomainName', () => { + const result = client.matchProjectFromDomainName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromDomainName', () => { + const result = client.matchLocationFromDomainName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDomainFromDomainName', () => { + const result = client.matchDomainFromDomainName(fakePath); + assert.strictEqual(result, "domainValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..934d701 --- /dev/null +++ b/owl-bot-staging/v1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'ManagedIdentitiesService', + filename: './managed-identities-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js new file mode 100644 index 0000000..df287d2 --- /dev/null +++ b/owl-bot-staging/v1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/managed-identities', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md new file mode 100644 index 0000000..94f33d6 --- /dev/null +++ b/owl-bot-staging/v1beta1/README.md @@ -0,0 +1 @@ +Managedidentities: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v1beta1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json new file mode 100644 index 0000000..887d031 --- /dev/null +++ b/owl-bot-staging/v1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/managed-identities", + "version": "0.1.0", + "description": "Managedidentities client for Node.js", + "repository": "googleapis/nodejs-managedidentities", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google managedidentities", + "managedidentities", + "managed identities service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto b/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto new file mode 100644 index 0000000..17bc165 --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto @@ -0,0 +1,389 @@ +// Copyright 2021 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.managedidentities.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/managedidentities/v1beta1/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ManagedIdentities.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1beta1;managedidentities"; +option java_multiple_files = true; +option java_outer_classname = "ManagedIdentitiesServiceProto"; +option java_package = "com.google.cloud.managedidentities.v1beta1"; +option objc_class_prefix = "GCMI"; +option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1beta1"; +option ruby_package = "Google::Cloud::ManagedIdentities::V1beta1"; + +service ManagedIdentitiesService { + option (google.api.default_host) = "managedidentities.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Microsoft AD domain. + rpc CreateMicrosoftAdDomain(CreateMicrosoftAdDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/global}/domains" + body: "domain" + }; + option (google.api.method_signature) = "parent,domain_name,domain"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Resets a domain's administrator password. + rpc ResetAdminPassword(ResetAdminPasswordRequest) returns (ResetAdminPasswordResponse) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:resetAdminPassword" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Lists domains in a project. + rpc ListDomains(ListDomainsRequest) returns (ListDomainsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/global}/domains" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets information about a domain. + rpc GetDomain(GetDomainRequest) returns (Domain) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/global/domains/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the metadata and configuration of a domain. + rpc UpdateDomain(UpdateDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{domain.name=projects/*/locations/global/domains/*}" + body: "domain" + }; + option (google.api.method_signature) = "domain,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Deletes a domain. + rpc DeleteDomain(DeleteDomainRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/global/domains/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OpMetadata" + }; + } + + // Adds an AD trust to a domain. + rpc AttachTrust(AttachTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:attachTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Updates the DNS conditional forwarder. + rpc ReconfigureTrust(ReconfigureTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:reconfigureTrust" + body: "*" + }; + option (google.api.method_signature) = "name,target_domain_name,target_dns_ip_addresses"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Removes an AD trust. + rpc DetachTrust(DetachTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:detachTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } + + // Validates a trust state, that the target domain is reachable, and that the + // target domain is able to accept incoming trust requests. + rpc ValidateTrust(ValidateTrustRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/global/domains/*}:validateTrust" + body: "*" + }; + option (google.api.method_signature) = "name,trust"; + option (google.longrunning.operation_info) = { + response_type: "Domain" + metadata_type: "OpMetadata" + }; + } +} + +// Represents the metadata of the long-running operation. +message OpMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for +// [CreateMicrosoftAdDomain][google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomain] +message CreateMicrosoftAdDomainRequest { + // Required. The resource project name and location using the form: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: + // * Must contain only lowercase letters, numbers, periods and hyphens. + // * Must start with a letter. + // * Must contain between 2-64 characters. + // * Must end with a number or a letter. + // * Must not start with period. + // * First segment length (mydomain form example above) shouldn't exceed + // 15 chars. + // * The last segment cannot be fully numeric. + // * Must be unique within the customer project. + string domain_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A Managed Identity domain resource. + Domain domain = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ResetAdminPassword][google.cloud.managedidentities.v1beta1.ResetAdminPassword] +message ResetAdminPasswordRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Response message for +// [ResetAdminPassword][google.cloud.managedidentities.v1beta1.ResetAdminPassword] +message ResetAdminPasswordResponse { + // A random password. See [admin][google.cloud.managedidentities.v1beta1.Domain.admin] for more information. + string password = 1; +} + +// Request message for +// [ListDomains][google.cloud.managedidentities.v1beta1.ListDomains] +message ListDomainsRequest { + // Required. The resource name of the domain location using the form: + // `projects/{project_id}/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Optional. The maximum number of items to return. + // If not specified, a default value of 1000 will be used. + // Regardless of the page_size value, the response may include a partial list. + // Callers should rely on a response's + // [next_page_token][google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token] + // to determine if there are additional results to list. + int32 page_size = 2; + + // The `next_page_token` value returned from a previous ListDomainsRequest + // request, if any. + string page_token = 3; + + // Optional. A filter specifying constraints of a list operation. + // For example, `Domain.fqdn="mydomain.myorginization"`. + string filter = 4; + + // Optional. Specifies the ordering of results. See + // [Sorting + // order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + // for more information. + string order_by = 5; +} + +// Response message for +// [ListDomains][google.cloud.managedidentities.v1beta1.ListDomains] +message ListDomainsResponse { + // A list of Managed Identities Service domains in the project. + repeated Domain domains = 1; + + // A token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; + + // A list of locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [GetDomain][google.cloud.managedidentities.v1beta1.GetDomain] +message GetDomainRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Request message for +// [UpdateDomain][google.cloud.managedidentities.v1beta1.UpdateDomain] +message UpdateDomainRequest { + // Required. Mask of fields to update. At least one path must be supplied in this + // field. The elements of the repeated paths field may only include + // fields from [Domain][google.cloud.managedidentities.v1beta1.Domain]: + // * `labels` + // * `locations` + // * `authorized_networks` + // * `audit_logs_enabled` + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Domain message with updated fields. Only supported fields specified in + // update_mask are updated. + Domain domain = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [DeleteDomain][google.cloud.managedidentities.v1beta1.DeleteDomain] +message DeleteDomainRequest { + // Required. The domain resource name using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; +} + +// Request message for +// [AttachTrust][google.cloud.managedidentities.v1beta1.AttachTrust] +message AttachTrustRequest { + // Required. The resource domain name, project name and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust resource. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ReconfigureTrust][google.cloud.managedidentities.v1beta1.ReconfigureTrust] +message ReconfigureTrustRequest { + // Required. The resource domain name, project name and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The fully-qualified target domain name which will be in trust with current + // domain. + string target_domain_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The target DNS server IP addresses to resolve the remote domain involved + // in the trust. + repeated string target_dns_ip_addresses = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [DetachTrust][google.cloud.managedidentities.v1beta1.DetachTrust] +message DetachTrustRequest { + // Required. The resource domain name, project name, and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust resource to removed. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [ValidateTrust][google.cloud.managedidentities.v1beta1.ValidateTrust] +message ValidateTrustRequest { + // Required. The resource domain name, project name, and location using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "managedidentities.googleapis.com/Domain" + } + ]; + + // Required. The domain trust to validate trust state for. + Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto b/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto new file mode 100644 index 0000000..a733e1c --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto @@ -0,0 +1,217 @@ +// Copyright 2021 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.managedidentities.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.ManagedIdentities.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1beta1;managedidentities"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.cloud.managedidentities.v1beta1"; +option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1beta1"; +option ruby_package = "Google::Cloud::ManagedIdentities::V1beta1"; + +// Represents a managed Microsoft Active Directory domain. +// If the domain is being changed, it will be placed into the UPDATING state, +// which indicates that the resource is being reconciled. At this point, Get +// will reflect an intermediate state. +message Domain { + option (google.api.resource) = { + type: "managedidentities.googleapis.com/Domain" + pattern: "projects/{project}/locations/{location}/domains/{domain}" + }; + + // Represents the different states of a managed domain. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The domain is being created. + CREATING = 1; + + // The domain has been created and is fully usable. + READY = 2; + + // The domain's configuration is being updated. + UPDATING = 3; + + // The domain is being deleted. + DELETING = 4; + + // The domain is being repaired and may be unusable. Details + // can be found in the `status_message` field. + REPAIRING = 5; + + // The domain is undergoing maintenance. + PERFORMING_MAINTENANCE = 6; + + // The domain is not serving requests. + UNAVAILABLE = 7; + } + + // Output only. The unique name of the domain using the form: + // `projects/{project_id}/locations/global/domains/{domain_name}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Resource labels that can contain user-provided metadata. + map labels = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The full names of the Google Compute Engine + // [networks](/compute/docs/networks-and-firewalls#networks) the domain + // instance is connected to. Networks can be added using UpdateDomain. + // The domain is only available on networks listed in `authorized_networks`. + // If CIDR subnets overlap between networks, domain creation will fail. + repeated string authorized_networks = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The CIDR range of internal addresses that are reserved for this + // domain. Reserved networks must be /24 or larger. Ranges must be + // unique and non-overlapping with existing subnets in + // [Domain].[authorized_networks]. + string reserved_ip_range = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Locations where domain needs to be provisioned. + // [regions][compute/docs/regions-zones/] + // e.g. us-west1 or us-east4 + // Service supports up to 4 locations at once. Each location will use a /26 + // block. + repeated string locations = 5 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The name of delegated administrator account used to perform + // Active Directory operations. If not specified, `setupadmin` will be used. + string admin = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The fully-qualified domain name of the exposed domain used by + // clients to connect to the service. Similar to what would be chosen for an + // Active Directory set up on an internal network. + string fqdn = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of this domain. + State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current status of this + // domain, if available. + string status_message = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current trusts associated with the domain. + repeated Trust trusts = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a relationship between two domains. This allows a controller in +// one domain to authenticate a user in another domain. +message Trust { + // Represents the different states of a domain trust. + enum State { + // Not set. + STATE_UNSPECIFIED = 0; + + // The domain trust is being created. + CREATING = 1; + + // The domain trust is being updated. + UPDATING = 2; + + // The domain trust is being deleted. + DELETING = 3; + + // The domain trust is connected. + CONNECTED = 4; + + // The domain trust is disconnected. + DISCONNECTED = 5; + } + + // Represents the different inter-forest trust types. + enum TrustType { + // Not set. + TRUST_TYPE_UNSPECIFIED = 0; + + // The forest trust. + FOREST = 1; + + // The external domain trust. + EXTERNAL = 2; + } + + // Represents the direction of trust. + // See + // [System.DirectoryServices.ActiveDirectory.TrustDirection](https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.trustdirection?view=netframework-4.7.2) + // for more information. + enum TrustDirection { + // Not set. + TRUST_DIRECTION_UNSPECIFIED = 0; + + // The inbound direction represents the trusting side. + INBOUND = 1; + + // The outboud direction represents the trusted side. + OUTBOUND = 2; + + // The bidirectional direction represents the trusted / trusting side. + BIDIRECTIONAL = 3; + } + + // The fully qualified target domain name which will be in trust with the + // current domain. + string target_domain_name = 1; + + // The type of trust represented by the trust resource. + TrustType trust_type = 2; + + // The trust direction, which decides if the current domain is trusted, + // trusting, or both. + TrustDirection trust_direction = 3; + + // The trust authentication type, which decides whether the trusted side has + // forest/domain wide access or selective access to an approved set of + // resources. + bool selective_authentication = 4; + + // The target DNS server IP addresses which can resolve the remote domain + // involved in the trust. + repeated string target_dns_ip_addresses = 5; + + // Input only. The trust secret used for the handshake + // with the target domain. It will not be stored. + string trust_handshake_secret = 6 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. The time the instance was created. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the trust. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // trust, if available. + string state_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last heartbeat time when the trust was known to be + // connected. + google.protobuf.Timestamp last_trust_heartbeat_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js new file mode 100644 index 0000000..326fa3c --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, trust) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust resource. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callAttachTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.attachTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAttachTrust(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js new file mode 100644 index 0000000..f9df294 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, domainName, domain) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource project name and location using the form: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segment length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + */ + // const domainName = 'abc123' + /** + * Required. A Managed Identity domain resource. + */ + // const domain = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callCreateMicrosoftAdDomain() { + // Construct request + const request = { + parent, + domainName, + domain, + }; + + // Run request + const [operation] = await managedidentitiesClient.createMicrosoftAdDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMicrosoftAdDomain(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js new file mode 100644 index 0000000..67d86ef --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callDeleteDomain() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await managedidentitiesClient.deleteDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteDomain(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js new file mode 100644 index 0000000..392c6bf --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, trust) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust resource to removed. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callDetachTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.detachTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDetachTrust(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js new file mode 100644 index 0000000..b9f6c89 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callGetDomain() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await managedidentitiesClient.getDomain(request); + console.log(response); + } + + callGetDomain(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js new file mode 100644 index 0000000..eafe434 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js @@ -0,0 +1,87 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * next_page_token google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token + * to determine if there are additional results to list. + */ + // const pageSize = 1234 + /** + * The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + */ + // const pageToken = 'abc123' + /** + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results. See + * Sorting + * order (https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + */ + // const orderBy = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callListDomains() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await managedidentitiesClient.listDomainsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDomains(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js new file mode 100644 index 0000000..a597883 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, targetDomainName, targetDnsIpAddresses) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The fully-qualified target domain name which will be in trust with current + * domain. + */ + // const targetDomainName = 'abc123' + /** + * Required. The target DNS server IP addresses to resolve the remote domain involved + * in the trust. + */ + // const targetDnsIpAddresses = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callReconfigureTrust() { + // Construct request + const request = { + name, + targetDomainName, + targetDnsIpAddresses, + }; + + // Run request + const [operation] = await managedidentitiesClient.reconfigureTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReconfigureTrust(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js new file mode 100644 index 0000000..baabacb --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callResetAdminPassword() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await managedidentitiesClient.resetAdminPassword(request); + console.log(response); + } + + callResetAdminPassword(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js new file mode 100644 index 0000000..e99ea24 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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(updateMask, domain) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include + * fields from Domain google.cloud.managedidentities.v1beta1.Domain: + * * `labels` + * * `locations` + * * `authorized_networks` + * * `audit_logs_enabled` + */ + // const updateMask = {} + /** + * Required. Domain message with updated fields. Only supported fields specified in + * update_mask are updated. + */ + // const domain = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callUpdateDomain() { + // Construct request + const request = { + updateMask, + domain, + }; + + // Run request + const [operation] = await managedidentitiesClient.updateDomain(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateDomain(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js new file mode 100644 index 0000000..eb48db2 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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, trust) { + // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + */ + // const name = 'abc123' + /** + * Required. The domain trust to validate trust state for. + */ + // const trust = {} + + // Imports the Managedidentities library + const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; + + // Instantiates a client + const managedidentitiesClient = new ManagedIdentitiesServiceClient(); + + async function callValidateTrust() { + // Construct request + const request = { + name, + trust, + }; + + // Run request + const [operation] = await managedidentitiesClient.validateTrust(request); + const [response] = await operation.promise(); + console.log(response); + } + + callValidateTrust(); + // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.managedidentities.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.managedidentities.v1beta1.json new file mode 100644 index 0000000..d55e495 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.managedidentities.v1beta1.json @@ -0,0 +1,463 @@ +{ + "clientLibrary": { + "name": "nodejs-managedidentities", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.managedidentities.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async", + "title": "ManagedIdentitiesService createMicrosoftAdDomain Sample", + "origin": "API_DEFINITION", + "description": " Creates a Microsoft AD domain.", + "canonical": true, + "file": "managed_identities_service.create_microsoft_ad_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMicrosoftAdDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.CreateMicrosoftAdDomain", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "domain_name", + "type": "TYPE_STRING" + }, + { + "name": "domain", + "type": ".google.cloud.managedidentities.v1beta1.Domain" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "CreateMicrosoftAdDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.CreateMicrosoftAdDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async", + "title": "ManagedIdentitiesService resetAdminPassword Sample", + "origin": "API_DEFINITION", + "description": " Resets a domain's administrator password.", + "canonical": true, + "file": "managed_identities_service.reset_admin_password.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetAdminPassword", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ResetAdminPassword", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ResetAdminPassword", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ResetAdminPassword", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async", + "title": "ManagedIdentitiesService listDomains Sample", + "origin": "API_DEFINITION", + "description": " Lists domains in a project.", + "canonical": true, + "file": "managed_identities_service.list_domains.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDomains", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ListDomains", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1beta1.ListDomainsResponse", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ListDomains", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ListDomains", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async", + "title": "ManagedIdentitiesService getDomain Sample", + "origin": "API_DEFINITION", + "description": " Gets information about a domain.", + "canonical": true, + "file": "managed_identities_service.get_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.GetDomain", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.managedidentities.v1beta1.Domain", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "GetDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.GetDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async", + "title": "ManagedIdentitiesService updateDomain Sample", + "origin": "API_DEFINITION", + "description": " Updates the metadata and configuration of a domain.", + "canonical": true, + "file": "managed_identities_service.update_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.UpdateDomain", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "domain", + "type": ".google.cloud.managedidentities.v1beta1.Domain" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "UpdateDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.UpdateDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async", + "title": "ManagedIdentitiesService deleteDomain Sample", + "origin": "API_DEFINITION", + "description": " Deletes a domain.", + "canonical": true, + "file": "managed_identities_service.delete_domain.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DeleteDomain", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "DeleteDomain", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DeleteDomain", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async", + "title": "ManagedIdentitiesService attachTrust Sample", + "origin": "API_DEFINITION", + "description": " Adds an AD trust to a domain.", + "canonical": true, + "file": "managed_identities_service.attach_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AttachTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.AttachTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1beta1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "AttachTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.AttachTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async", + "title": "ManagedIdentitiesService reconfigureTrust Sample", + "origin": "API_DEFINITION", + "description": " Updates the DNS conditional forwarder.", + "canonical": true, + "file": "managed_identities_service.reconfigure_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReconfigureTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ReconfigureTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "target_domain_name", + "type": "TYPE_STRING" + }, + { + "name": "target_dns_ip_addresses", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ReconfigureTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ReconfigureTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async", + "title": "ManagedIdentitiesService detachTrust Sample", + "origin": "API_DEFINITION", + "description": " Removes an AD trust.", + "canonical": true, + "file": "managed_identities_service.detach_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetachTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DetachTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1beta1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "DetachTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DetachTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + }, + { + "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async", + "title": "ManagedIdentitiesService validateTrust Sample", + "origin": "API_DEFINITION", + "description": " Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.", + "canonical": true, + "file": "managed_identities_service.validate_trust.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ValidateTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ValidateTrust", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "trust", + "type": ".google.cloud.managedidentities.v1beta1.Trust" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ManagedIdentitiesServiceClient", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" + }, + "method": { + "shortName": "ValidateTrust", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ValidateTrust", + "service": { + "shortName": "ManagedIdentitiesService", + "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts new file mode 100644 index 0000000..131c914 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 v1beta1 from './v1beta1'; +const ManagedIdentitiesServiceClient = v1beta1.ManagedIdentitiesServiceClient; +type ManagedIdentitiesServiceClient = v1beta1.ManagedIdentitiesServiceClient; +export {v1beta1, ManagedIdentitiesServiceClient}; +export default {v1beta1, ManagedIdentitiesServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 0000000..7566a4e --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,127 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.managedidentities.v1beta1", + "libraryPackage": "@google-cloud/managed-identities", + "services": { + "ManagedIdentitiesService": { + "clients": { + "grpc": { + "libraryClient": "ManagedIdentitiesServiceClient", + "rpcs": { + "ResetAdminPassword": { + "methods": [ + "resetAdminPassword" + ] + }, + "GetDomain": { + "methods": [ + "getDomain" + ] + }, + "CreateMicrosoftAdDomain": { + "methods": [ + "createMicrosoftAdDomain" + ] + }, + "UpdateDomain": { + "methods": [ + "updateDomain" + ] + }, + "DeleteDomain": { + "methods": [ + "deleteDomain" + ] + }, + "AttachTrust": { + "methods": [ + "attachTrust" + ] + }, + "ReconfigureTrust": { + "methods": [ + "reconfigureTrust" + ] + }, + "DetachTrust": { + "methods": [ + "detachTrust" + ] + }, + "ValidateTrust": { + "methods": [ + "validateTrust" + ] + }, + "ListDomains": { + "methods": [ + "listDomains", + "listDomainsStream", + "listDomainsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ManagedIdentitiesServiceClient", + "rpcs": { + "ResetAdminPassword": { + "methods": [ + "resetAdminPassword" + ] + }, + "GetDomain": { + "methods": [ + "getDomain" + ] + }, + "CreateMicrosoftAdDomain": { + "methods": [ + "createMicrosoftAdDomain" + ] + }, + "UpdateDomain": { + "methods": [ + "updateDomain" + ] + }, + "DeleteDomain": { + "methods": [ + "deleteDomain" + ] + }, + "AttachTrust": { + "methods": [ + "attachTrust" + ] + }, + "ReconfigureTrust": { + "methods": [ + "reconfigureTrust" + ] + }, + "DetachTrust": { + "methods": [ + "detachTrust" + ] + }, + "ValidateTrust": { + "methods": [ + "validateTrust" + ] + }, + "ListDomains": { + "methods": [ + "listDomains", + "listDomainsStream", + "listDomainsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts new file mode 100644 index 0000000..a6d30bc --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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. ** + +export {ManagedIdentitiesServiceClient} from './managed_identities_service_client'; diff --git a/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client.ts new file mode 100644 index 0000000..b227ff3 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client.ts @@ -0,0 +1,1548 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/managed_identities_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './managed_identities_service_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta1 + */ +export class ManagedIdentitiesServiceClient { + 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; + managedIdentitiesServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ManagedIdentitiesServiceClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ManagedIdentitiesServiceClient; + 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); + + // 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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 = { + domainPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/domains/{domain}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listDomains: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'domains') + }; + + 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.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=projects/*/locations/global/domains/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy',},{get: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/global/operations}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const createMicrosoftAdDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const updateDomainResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const updateDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const deleteDomainResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteDomainMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const attachTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const attachTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const reconfigureTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const reconfigureTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const detachTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const detachTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + const validateTrustResponse = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; + const validateTrustMetadata = protoFilesRoot.lookup( + '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createMicrosoftAdDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMicrosoftAdDomainResponse.decode.bind(createMicrosoftAdDomainResponse), + createMicrosoftAdDomainMetadata.decode.bind(createMicrosoftAdDomainMetadata)), + updateDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateDomainResponse.decode.bind(updateDomainResponse), + updateDomainMetadata.decode.bind(updateDomainMetadata)), + deleteDomain: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteDomainResponse.decode.bind(deleteDomainResponse), + deleteDomainMetadata.decode.bind(deleteDomainMetadata)), + attachTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + attachTrustResponse.decode.bind(attachTrustResponse), + attachTrustMetadata.decode.bind(attachTrustMetadata)), + reconfigureTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reconfigureTrustResponse.decode.bind(reconfigureTrustResponse), + reconfigureTrustMetadata.decode.bind(reconfigureTrustMetadata)), + detachTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + detachTrustResponse.decode.bind(detachTrustResponse), + detachTrustMetadata.decode.bind(detachTrustMetadata)), + validateTrust: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + validateTrustResponse.decode.bind(validateTrustResponse), + validateTrustMetadata.decode.bind(validateTrustMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.managedidentities.v1beta1.ManagedIdentitiesService', 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 = gax.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.managedIdentitiesServiceStub) { + return this.managedIdentitiesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.managedidentities.v1beta1.ManagedIdentitiesService. + this.managedIdentitiesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.managedidentities.v1beta1.ManagedIdentitiesService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.managedidentities.v1beta1.ManagedIdentitiesService, + 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 managedIdentitiesServiceStubMethods = + ['createMicrosoftAdDomain', 'resetAdminPassword', 'listDomains', 'getDomain', 'updateDomain', 'deleteDomain', 'attachTrust', 'reconfigureTrust', 'detachTrust', 'validateTrust']; + for (const methodName of managedIdentitiesServiceStubMethods) { + const callPromise = this.managedIdentitiesServiceStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.managedIdentitiesServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'managedidentities.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 'managedidentities.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' + ]; + } + + 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 -- + // ------------------- +/** + * Resets a domain's administrator password. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @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 [ResetAdminPasswordResponse]{@link google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse}. + * 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/v1beta1/managed_identities_service.reset_admin_password.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async + */ + resetAdminPassword( + request?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|undefined, {}|undefined + ]>; + resetAdminPassword( + request: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): void; + resetAdminPassword( + request: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, + callback: Callback< + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): void; + resetAdminPassword( + request?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, + protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.resetAdminPassword(request, options, callback); + } +/** + * Gets information about a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @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 [Domain]{@link google.cloud.managedidentities.v1beta1.Domain}. + * 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/v1beta1/managed_identities_service.get_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async + */ + getDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|undefined, {}|undefined + ]>; + getDomain( + request: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, + {}|null|undefined>): void; + getDomain( + request: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, + callback: Callback< + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, + {}|null|undefined>): void; + getDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IDomain, + protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getDomain(request, options, callback); + } + +/** + * Creates a Microsoft AD domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource project name and location using the form: + * `projects/{project_id}/locations/global` + * @param {string} request.domainName + * Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: + * * Must contain only lowercase letters, numbers, periods and hyphens. + * * Must start with a letter. + * * Must contain between 2-64 characters. + * * Must end with a number or a letter. + * * Must not start with period. + * * First segment length (mydomain form example above) shouldn't exceed + * 15 chars. + * * The last segment cannot be fully numeric. + * * Must be unique within the customer project. + * @param {google.cloud.managedidentities.v1beta1.Domain} request.domain + * Required. A Managed Identity domain resource. + * @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/v1beta1/managed_identities_service.create_microsoft_ad_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async + */ + createMicrosoftAdDomain( + request?: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMicrosoftAdDomain( + request: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMicrosoftAdDomain( + request: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMicrosoftAdDomain( + request?: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createMicrosoftAdDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMicrosoftAdDomain()`. + * @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/v1beta1/managed_identities_service.create_microsoft_ad_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async + */ + async checkCreateMicrosoftAdDomainProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createMicrosoftAdDomain, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the metadata and configuration of a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include + * fields from {@link google.cloud.managedidentities.v1beta1.Domain|Domain}: + * * `labels` + * * `locations` + * * `authorized_networks` + * * `audit_logs_enabled` + * @param {google.cloud.managedidentities.v1beta1.Domain} request.domain + * Required. Domain message with updated fields. Only supported fields specified in + * update_mask are updated. + * @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/v1beta1/managed_identities_service.update_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async + */ + updateDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateDomain( + request: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDomain( + request: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'domain.name': request.domain!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateDomain()`. + * @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/v1beta1/managed_identities_service.update_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async + */ + async checkUpdateDomainProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateDomain, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The domain resource name using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @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/v1beta1/managed_identities_service.delete_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async + */ + deleteDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteDomain( + request: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDomain( + request: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteDomain( + request?: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteDomain(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteDomain()`. + * @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/v1beta1/managed_identities_service.delete_domain.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async + */ + async checkDeleteDomainProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteDomain, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Adds an AD trust to a domain. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust + * Required. The domain trust resource. + * @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/v1beta1/managed_identities_service.attach_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async + */ + attachTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + attachTrust( + request: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + attachTrust( + request: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + attachTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.attachTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `attachTrust()`. + * @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/v1beta1/managed_identities_service.attach_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async + */ + async checkAttachTrustProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.attachTrust, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the DNS conditional forwarder. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {string} request.targetDomainName + * Required. The fully-qualified target domain name which will be in trust with current + * domain. + * @param {string[]} request.targetDnsIpAddresses + * Required. The target DNS server IP addresses to resolve the remote domain involved + * in the trust. + * @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/v1beta1/managed_identities_service.reconfigure_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async + */ + reconfigureTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + reconfigureTrust( + request: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reconfigureTrust( + request: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reconfigureTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.reconfigureTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `reconfigureTrust()`. + * @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/v1beta1/managed_identities_service.reconfigure_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async + */ + async checkReconfigureTrustProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.reconfigureTrust, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Removes an AD trust. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust + * Required. The domain trust resource to removed. + * @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/v1beta1/managed_identities_service.detach_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async + */ + detachTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + detachTrust( + request: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + detachTrust( + request: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + detachTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.detachTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `detachTrust()`. + * @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/v1beta1/managed_identities_service.detach_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async + */ + async checkDetachTrustProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.detachTrust, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Validates a trust state, that the target domain is reachable, and that the + * target domain is able to accept incoming trust requests. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource domain name, project name, and location using the form: + * `projects/{project_id}/locations/global/domains/{domain_name}` + * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust + * Required. The domain trust to validate trust state for. + * @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/v1beta1/managed_identities_service.validate_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async + */ + validateTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + validateTrust( + request: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateTrust( + request: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + validateTrust( + request?: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.validateTrust(request, options, callback); + } +/** + * Check the status of the long running operation returned by `validateTrust()`. + * @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/v1beta1/managed_identities_service.validate_trust.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async + */ + async checkValidateTrustProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.validateTrust, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists domains in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} request.filter + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} request.orderBy + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 [Domain]{@link google.cloud.managedidentities.v1beta1.Domain}. + * 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 `listDomainsAsync()` + * 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. + */ + listDomains( + request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IDomain[], + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest|null, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse + ]>; + listDomains( + request: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1beta1.IDomain>): void; + listDomains( + request: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + callback: PaginationCallback< + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1beta1.IDomain>): void; + listDomains( + request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1beta1.IDomain>, + callback?: PaginationCallback< + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, + protos.google.cloud.managedidentities.v1beta1.IDomain>): + Promise<[ + protos.google.cloud.managedidentities.v1beta1.IDomain[], + protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest|null, + protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listDomains(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 domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} request.filter + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} request.orderBy + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 [Domain]{@link google.cloud.managedidentities.v1beta1.Domain} 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 `listDomainsAsync()` + * 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. + */ + listDomainsStream( + request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listDomains']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDomains.createStream( + this.innerApiCalls.listDomains as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listDomains`, 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 domain location using the form: + * `projects/{project_id}/locations/global` + * @param {number} request.pageSize + * Optional. The maximum number of items to return. + * If not specified, a default value of 1000 will be used. + * Regardless of the page_size value, the response may include a partial list. + * Callers should rely on a response's + * {@link google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} + * to determine if there are additional results to list. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous ListDomainsRequest + * request, if any. + * @param {string} request.filter + * Optional. A filter specifying constraints of a list operation. + * For example, `Domain.fqdn="mydomain.myorginization"`. + * @param {string} request.orderBy + * Optional. Specifies the ordering of results. See + * [Sorting + * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) + * for more information. + * @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 + * [Domain]{@link google.cloud.managedidentities.v1beta1.Domain}. 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/v1beta1/managed_identities_service.list_domains.js + * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async + */ + listDomainsAsync( + request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listDomains']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDomains.asyncIterate( + this.innerApiCalls['listDomains'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified domain resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} domain + * @returns {string} Resource name string. + */ + domainPath(project:string,location:string,domain:string) { + return this.pathTemplates.domainPathTemplate.render({ + project: project, + location: location, + domain: domain, + }); + } + + /** + * Parse the project from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).project; + } + + /** + * Parse the location from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).location; + } + + /** + * Parse the domain from Domain resource. + * + * @param {string} domainName + * A fully-qualified path representing Domain resource. + * @returns {string} A string representing the domain. + */ + matchDomainFromDomainName(domainName: string) { + return this.pathTemplates.domainPathTemplate.match(domainName).domain; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified 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; + } + + /** + * 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.managedIdentitiesServiceStub && !this._terminated) { + return this.managedIdentitiesServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client_config.json new file mode 100644 index 0000000..c863d5e --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client_config.json @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService": { + "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": { + "CreateMicrosoftAdDomain": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetAdminPassword": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListDomains": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDomain": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDomain": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteDomain": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AttachTrust": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReconfigureTrust": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DetachTrust": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ValidateTrust": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_proto_list.json new file mode 100644 index 0000000..dbe4729 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto", + "../../protos/google/cloud/managedidentities/v1beta1/resource.proto" +] diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..026805f --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const managedidentities = require('@google-cloud/managed-identities'); + +function main() { + const managedIdentitiesServiceClient = new managedidentities.ManagedIdentitiesServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..041ef62 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 {ManagedIdentitiesServiceClient} from '@google-cloud/managed-identities'; + +// check that the client class type name can be used +function doStuffWithManagedIdentitiesServiceClient(client: ManagedIdentitiesServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const managedIdentitiesServiceClient = new ManagedIdentitiesServiceClient(); + doStuffWithManagedIdentitiesServiceClient(managedIdentitiesServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1beta1/test/gapic_managed_identities_service_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_managed_identities_service_v1beta1.ts new file mode 100644 index 0000000..f430592 --- /dev/null +++ b/owl-bot-staging/v1beta1/test/gapic_managed_identities_service_v1beta1.ts @@ -0,0 +1,1744 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// 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 managedidentitiesserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +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('v1beta1.ManagedIdentitiesServiceClient', () => { + it('has servicePath', () => { + const servicePath = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.managedIdentitiesServiceStub, undefined); + await client.initialize(); + assert(client.managedIdentitiesServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.managedIdentitiesServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.managedIdentitiesServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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 managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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('resetAdminPassword', () => { + it('invokes resetAdminPassword without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse()); + client.innerApiCalls.resetAdminPassword = stubSimpleCall(expectedResponse); + const [response] = await client.resetAdminPassword(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes resetAdminPassword without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse()); + client.innerApiCalls.resetAdminPassword = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetAdminPassword( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes resetAdminPassword with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.resetAdminPassword = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.resetAdminPassword(request), expectedError); + assert((client.innerApiCalls.resetAdminPassword as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes resetAdminPassword with closed client', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.resetAdminPassword(request), expectedError); + }); + }); + + describe('getDomain', () => { + it('invokes getDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()); + client.innerApiCalls.getDomain = stubSimpleCall(expectedResponse); + const [response] = await client.getDomain(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()); + client.innerApiCalls.getDomain = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDomain( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IDomain|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getDomain with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getDomain = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDomain(request), expectedError); + assert((client.innerApiCalls.getDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getDomain with closed client', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDomain(request), expectedError); + }); + }); + + describe('createMicrosoftAdDomain', () => { + it('invokes createMicrosoftAdDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMicrosoftAdDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createMicrosoftAdDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMicrosoftAdDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createMicrosoftAdDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMicrosoftAdDomain(request), expectedError); + assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createMicrosoftAdDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMicrosoftAdDomain(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateMicrosoftAdDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkCreateMicrosoftAdDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMicrosoftAdDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkCreateMicrosoftAdDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateDomain', () => { + it('invokes updateDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest()); + request.domain = {}; + request.domain.name = ''; + const expectedHeaderRequestParams = "domain.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest()); + request.domain = {}; + request.domain.name = ''; + const expectedHeaderRequestParams = "domain.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest()); + request.domain = {}; + request.domain.name = ''; + const expectedHeaderRequestParams = "domain.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateDomain(request), expectedError); + assert((client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest()); + request.domain = {}; + request.domain.name = ''; + const expectedHeaderRequestParams = "domain.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateDomain(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkUpdateDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkUpdateDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteDomain', () => { + it('invokes deleteDomain without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteDomain = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDomain(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteDomain without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteDomain = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDomain( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteDomain with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteDomain(request), expectedError); + assert((client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteDomain with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteDomain(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteDomain as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteDomainProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkDeleteDomainProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteDomainProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkDeleteDomainProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('attachTrust', () => { + it('invokes attachTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.attachTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.attachTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes attachTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.attachTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.attachTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes attachTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.attachTrust(request), expectedError); + assert((client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes attachTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.attachTrust(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.attachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkAttachTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkAttachTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAttachTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkAttachTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('reconfigureTrust', () => { + it('invokes reconfigureTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.reconfigureTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes reconfigureTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.reconfigureTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reconfigureTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes reconfigureTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.reconfigureTrust(request), expectedError); + assert((client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes reconfigureTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.reconfigureTrust(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.reconfigureTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkReconfigureTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkReconfigureTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReconfigureTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkReconfigureTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('detachTrust', () => { + it('invokes detachTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.detachTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.detachTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes detachTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.detachTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detachTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes detachTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.detachTrust(request), expectedError); + assert((client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes detachTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.detachTrust(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.detachTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDetachTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkDetachTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDetachTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkDetachTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('validateTrust', () => { + it('invokes validateTrust without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.validateTrust = stubLongRunningCall(expectedResponse); + const [operation] = await client.validateTrust(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes validateTrust without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.validateTrust = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.validateTrust( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes validateTrust with call error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.validateTrust(request), expectedError); + assert((client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes validateTrust with LRO error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.validateTrust(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.validateTrust as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkValidateTrustProgress without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkValidateTrustProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkValidateTrustProgress with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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.checkValidateTrustProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listDomains', () => { + it('invokes listDomains without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + ]; + client.innerApiCalls.listDomains = stubSimpleCall(expectedResponse); + const [response] = await client.listDomains(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listDomains as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listDomains without error using callback', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + ]; + client.innerApiCalls.listDomains = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDomains( + request, + (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IDomain[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listDomains as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listDomains with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listDomains = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDomains(request), expectedError); + assert((client.innerApiCalls.listDomains as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listDomainsStream without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + ]; + client.descriptors.page.listDomains.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listDomainsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.managedidentities.v1beta1.Domain[] = []; + stream.on('data', (response: protos.google.cloud.managedidentities.v1beta1.Domain) => { + 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.listDomains.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); + assert.strictEqual( + (client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listDomainsStream with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listDomains.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listDomainsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.managedidentities.v1beta1.Domain[] = []; + stream.on('data', (response: protos.google.cloud.managedidentities.v1beta1.Domain) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); + assert.strictEqual( + (client.descriptors.page.listDomains.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listDomains without error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), + ]; + client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.managedidentities.v1beta1.IDomain[] = []; + const iterable = client.listDomainsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listDomains with error', async () => { + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDomainsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.managedidentities.v1beta1.IDomain[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listDomains.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('domain', () => { + const fakePath = "/rendered/path/domain"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + domain: "domainValue", + }; + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.domainPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.domainPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('domainPath', () => { + const result = client.domainPath("projectValue", "locationValue", "domainValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.domainPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDomainName', () => { + const result = client.matchProjectFromDomainName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromDomainName', () => { + const result = client.matchLocationFromDomainName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDomainFromDomainName', () => { + const result = client.matchDomainFromDomainName(fakePath); + assert.strictEqual(result, "domainValue"); + assert((client.pathTemplates.domainPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ + 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)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js new file mode 100644 index 0000000..934d701 --- /dev/null +++ b/owl-bot-staging/v1beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'ManagedIdentitiesService', + filename: './managed-identities-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 09c26ed5d5d251e7b07e21080cb55b90bbbc4232 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:22:59 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 64 - .../v1/managed_identities_service.proto | 422 ---- .../cloud/managedidentities/v1/resource.proto | 213 -- ...managed_identities_service.attach_trust.js | 65 - ...ties_service.create_microsoft_ad_domain.js | 80 - ...anaged_identities_service.delete_domain.js | 60 - ...managed_identities_service.detach_trust.js | 65 - .../managed_identities_service.get_domain.js | 59 - ...managed_identities_service.list_domains.js | 87 - ...ed_identities_service.reconfigure_trust.js | 72 - ...identities_service.reset_admin_password.js | 59 - ...anaged_identities_service.update_domain.js | 70 - ...naged_identities_service.validate_trust.js | 65 - ...ata.google.cloud.managedidentities.v1.json | 463 ----- owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 127 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../v1/managed_identities_service_client.ts | 1581 --------------- ...aged_identities_service_client_config.json | 76 - ...managed_identities_service_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../gapic_managed_identities_service_v1.ts | 1744 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - owl-bot-staging/v1beta1/.eslintignore | 7 - owl-bot-staging/v1beta1/.eslintrc.json | 3 - owl-bot-staging/v1beta1/.gitignore | 14 - owl-bot-staging/v1beta1/.jsdoc.js | 55 - owl-bot-staging/v1beta1/.mocharc.js | 33 - owl-bot-staging/v1beta1/.prettierrc.js | 22 - owl-bot-staging/v1beta1/README.md | 1 - .../v1beta1/linkinator.config.json | 16 - owl-bot-staging/v1beta1/package.json | 64 - .../v1beta1/managed_identities_service.proto | 389 ---- .../managedidentities/v1beta1/resource.proto | 217 -- ...managed_identities_service.attach_trust.js | 65 - ...ties_service.create_microsoft_ad_domain.js | 79 - ...anaged_identities_service.delete_domain.js | 60 - ...managed_identities_service.detach_trust.js | 65 - .../managed_identities_service.get_domain.js | 59 - ...managed_identities_service.list_domains.js | 87 - ...ed_identities_service.reconfigure_trust.js | 72 - ...identities_service.reset_admin_password.js | 59 - ...anaged_identities_service.update_domain.js | 71 - ...naged_identities_service.validate_trust.js | 65 - ...oogle.cloud.managedidentities.v1beta1.json | 463 ----- owl-bot-staging/v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 127 -- owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 - .../managed_identities_service_client.ts | 1548 --------------- ...aged_identities_service_client_config.json | 66 - ...managed_identities_service_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - ...apic_managed_identities_service_v1beta1.ts | 1744 ----------------- owl-bot-staging/v1beta1/tsconfig.json | 19 - owl-bot-staging/v1beta1/webpack.config.js | 64 - src/v1/managed_identities_service_client.ts | 95 +- .../managed_identities_service_client.ts | 95 +- 70 files changed, 166 insertions(+), 11476 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/resource.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.attach_trust.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.delete_domain.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.detach_trust.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.get_domain.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.list_domains.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.update_domain.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/managed_identities_service.validate_trust.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.managedidentities.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/managed_identities_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/managed_identities_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/managed_identities_service_proto_list.json delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_managed_identities_service_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js delete mode 100644 owl-bot-staging/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1beta1/.gitignore delete mode 100644 owl-bot-staging/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1beta1/README.md delete mode 100644 owl-bot-staging/v1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1beta1/package.json delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.managedidentities.v1beta1.json delete mode 100644 owl-bot-staging/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client_config.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_proto_list.json delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1beta1/test/gapic_managed_identities_service_v1beta1.ts delete mode 100644 owl-bot-staging/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index df287d2..0000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/managed-identities', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index 94f33d6..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Managedidentities: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index 887d031..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/managed-identities", - "version": "0.1.0", - "description": "Managedidentities client for Node.js", - "repository": "googleapis/nodejs-managedidentities", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google managedidentities", - "managedidentities", - "managed identities service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto b/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto deleted file mode 100644 index 9112ac6..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/managed_identities_service.proto +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright 2019 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.managedidentities.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/managedidentities/v1/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ManagedIdentities.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1;managedidentities"; -option java_multiple_files = true; -option java_outer_classname = "ManagedIdentitiesServiceProto"; -option java_package = "com.google.cloud.managedidentities.v1"; -option objc_class_prefix = "GCMI"; -option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1"; -option ruby_package = "Google::Cloud::ManagedIdentities::V1"; - -// API Overview -// -// The `managedidentites.googleapis.com` service implements the Google Cloud -// Managed Identites API for identity services -// (e.g. Microsoft Active Directory). -// -// The Managed Identities service provides methods to manage -// (create/read/update/delete) domains, reset managed identities admin password, -// add/remove domain controllers in GCP regions and add/remove VPC peering. -// -// Data Model -// -// The Managed Identities service exposes the following resources: -// -// * Locations as global, named as follows: -// `projects/{project_id}/locations/global`. -// -// * Domains, named as follows: -// `/projects/{project_id}/locations/global/domain/{domain_name}`. -// -// The `{domain_name}` refers to fully qualified domain name in the customer -// project e.g. mydomain.myorganization.com, with the following restrictions: -// -// * Must contain only lowercase letters, numbers, periods and hyphens. -// * Must start with a letter. -// * Must contain between 2-64 characters. -// * Must end with a number or a letter. -// * Must not start with period. -// * First segement length (mydomain form example above) shouldn't exceed -// 15 chars. -// * The last segment cannot be fully numeric. -// * Must be unique within the customer project. -service ManagedIdentitiesService { - option (google.api.default_host) = "managedidentities.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a Microsoft AD domain. - rpc CreateMicrosoftAdDomain(CreateMicrosoftAdDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/global}/domains" - body: "domain" - }; - option (google.api.method_signature) = "parent,domain_name,domain"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Resets a domain's administrator password. - rpc ResetAdminPassword(ResetAdminPasswordRequest) returns (ResetAdminPasswordResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:resetAdminPassword" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Lists domains in a project. - rpc ListDomains(ListDomainsRequest) returns (ListDomainsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/global}/domains" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information about a domain. - rpc GetDomain(GetDomainRequest) returns (Domain) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/global/domains/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the metadata and configuration of a domain. - rpc UpdateDomain(UpdateDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{domain.name=projects/*/locations/global/domains/*}" - body: "domain" - }; - option (google.api.method_signature) = "domain,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Deletes a domain. - rpc DeleteDomain(DeleteDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/global/domains/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OpMetadata" - }; - } - - // Adds an AD trust to a domain. - rpc AttachTrust(AttachTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:attachTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Updates the DNS conditional forwarder. - rpc ReconfigureTrust(ReconfigureTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:reconfigureTrust" - body: "*" - }; - option (google.api.method_signature) = "name,target_domain_name,target_dns_ip_addresses"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Removes an AD trust. - rpc DetachTrust(DetachTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:detachTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Validates a trust state, that the target domain is reachable, and that the - // target domain is able to accept incoming trust requests. - rpc ValidateTrust(ValidateTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/global/domains/*}:validateTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } -} - -// Represents the metadata of the long-running operation. -message OpMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for -// [CreateMicrosoftAdDomain][google.cloud.managedidentities.v1.CreateMicrosoftAdDomain] -message CreateMicrosoftAdDomainRequest { - // Required. The resource project name and location using the form: - // `projects/{project_id}/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The fully qualified domain name. - // e.g. mydomain.myorganization.com, with the following restrictions: - // - // * Must contain only lowercase letters, numbers, periods and hyphens. - // * Must start with a letter. - // * Must contain between 2-64 characters. - // * Must end with a number or a letter. - // * Must not start with period. - // * First segement length (mydomain form example above) shouldn't exceed - // 15 chars. - // * The last segment cannot be fully numeric. - // * Must be unique within the customer project. - string domain_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Managed Identity domain resource. - Domain domain = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword] -message ResetAdminPasswordRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Response message for -// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword] -message ResetAdminPasswordResponse { - // A random password. See [admin][google.cloud.managedidentities.v1.Domain.admin] for more information. - string password = 1; -} - -// Request message for -// [ListDomains][google.cloud.managedidentities.v1.ListDomains] -message ListDomainsRequest { - // Required. The resource name of the domain location using the form: - // `projects/{project_id}/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Optional. The maximum number of items to return. - // If not specified, a default value of 1000 will be used. - // Regardless of the page_size value, the response may include a partial list. - // Callers should rely on a response's - // [next_page_token][google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token] - // to determine if there are additional results to list. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The `next_page_token` value returned from a previous ListDomainsRequest - // request, if any. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A filter specifying constraints of a list operation. - // For example, `Domain.fqdn="mydomain.myorginization"`. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the ordering of results. See - // [Sorting - // order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - // for more information. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [ListDomains][google.cloud.managedidentities.v1.ListDomains] -message ListDomainsResponse { - // A list of Managed Identities Service domains in the project. - repeated Domain domains = 1; - - // A token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; - - // A list of locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for [GetDomain][google.cloud.managedidentities.v1.GetDomain] -message GetDomainRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Request message for -// [UpdateDomain][google.cloud.managedidentities.v1.UpdateDomain] -message UpdateDomainRequest { - // Required. Mask of fields to update. At least one path must be supplied in this - // field. The elements of the repeated paths field may only include - // fields from [Domain][google.cloud.managedidentities.v1.Domain]: - // * `labels` - // * `locations` - // * `authorized_networks` - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Domain message with updated fields. Only supported fields specified in - // update_mask are updated. - Domain domain = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [DeleteDomain][google.cloud.managedidentities.v1.DeleteDomain] -message DeleteDomainRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Request message for -// [AttachTrust][google.cloud.managedidentities.v1.AttachTrust] -message AttachTrustRequest { - // Required. The resource domain name, project name and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust resource. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ReconfigureTrust][google.cloud.managedidentities.v1.ReconfigureTrust] -message ReconfigureTrustRequest { - // Required. The resource domain name, project name and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The fully-qualified target domain name which will be in trust with current - // domain. - string target_domain_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The target DNS server IP addresses to resolve the remote domain involved - // in the trust. - repeated string target_dns_ip_addresses = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [DetachTrust][google.cloud.managedidentities.v1.DetachTrust] -message DetachTrustRequest { - // Required. The resource domain name, project name, and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust resource to removed. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ValidateTrust][google.cloud.managedidentities.v1.ValidateTrust] -message ValidateTrustRequest { - // Required. The resource domain name, project name, and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust to validate trust state for. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/resource.proto b/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/resource.proto deleted file mode 100644 index f1b5ae5..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/managedidentities/v1/resource.proto +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright 2019 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.managedidentities.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.ManagedIdentities.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1;managedidentities"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.cloud.managedidentities.v1"; -option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1"; -option ruby_package = "Google::Cloud::ManagedIdentities::V1"; - -// Represents a managed Microsoft Active Directory domain. -message Domain { - option (google.api.resource) = { - type: "managedidentities.googleapis.com/Domain" - pattern: "projects/{project}/locations/{location}/domains/{domain}" - }; - - // Represents the different states of a managed domain. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The domain is being created. - CREATING = 1; - - // The domain has been created and is fully usable. - READY = 2; - - // The domain's configuration is being updated. - UPDATING = 3; - - // The domain is being deleted. - DELETING = 4; - - // The domain is being repaired and may be unusable. Details - // can be found in the `status_message` field. - REPAIRING = 5; - - // The domain is undergoing maintenance. - PERFORMING_MAINTENANCE = 6; - - // The domain is not serving requests. - UNAVAILABLE = 7; - } - - // Required. The unique name of the domain using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Resource labels that can contain user-provided metadata. - map labels = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The full names of the Google Compute Engine - // [networks](/compute/docs/networks-and-firewalls#networks) the domain - // instance is connected to. Networks can be added using UpdateDomain. - // The domain is only available on networks listed in `authorized_networks`. - // If CIDR subnets overlap between networks, domain creation will fail. - repeated string authorized_networks = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The CIDR range of internal addresses that are reserved for this - // domain. Reserved networks must be /24 or larger. Ranges must be - // unique and non-overlapping with existing subnets in - // [Domain].[authorized_networks]. - string reserved_ip_range = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Locations where domain needs to be provisioned. - // [regions][compute/docs/regions-zones/] - // e.g. us-west1 or us-east4 - // Service supports up to 4 locations at once. Each location will use a /26 - // block. - repeated string locations = 5 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The name of delegated administrator account used to perform - // Active Directory operations. If not specified, `setupadmin` will be used. - string admin = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The fully-qualified domain name of the exposed domain used by - // clients to connect to the service. Similar to what would be chosen for an - // Active Directory set up on an internal network. - string fqdn = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time. - google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of this domain. - State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current status of this - // domain, if available. - string status_message = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current trusts associated with the domain. - repeated Trust trusts = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a relationship between two domains. This allows a controller in -// one domain to authenticate a user in another domain. -message Trust { - // Represents the different states of a domain trust. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The domain trust is being created. - CREATING = 1; - - // The domain trust is being updated. - UPDATING = 2; - - // The domain trust is being deleted. - DELETING = 3; - - // The domain trust is connected. - CONNECTED = 4; - - // The domain trust is disconnected. - DISCONNECTED = 5; - } - - // Represents the different inter-forest trust types. - enum TrustType { - // Not set. - TRUST_TYPE_UNSPECIFIED = 0; - - // The forest trust. - FOREST = 1; - - // The external domain trust. - EXTERNAL = 2; - } - - // Represents the direction of trust. - // See - // [System.DirectoryServices.ActiveDirectory.TrustDirection](https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.trustdirection?view=netframework-4.7.2) - // for more information. - enum TrustDirection { - // Not set. - TRUST_DIRECTION_UNSPECIFIED = 0; - - // The inbound direction represents the trusting side. - INBOUND = 1; - - // The outboud direction represents the trusted side. - OUTBOUND = 2; - - // The bidirectional direction represents the trusted / trusting side. - BIDIRECTIONAL = 3; - } - - // Required. The fully qualified target domain name which will be in trust with the - // current domain. - string target_domain_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of trust represented by the trust resource. - TrustType trust_type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The trust direction, which decides if the current domain is trusted, - // trusting, or both. - TrustDirection trust_direction = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The trust authentication type, which decides whether the trusted side has - // forest/domain wide access or selective access to an approved set of - // resources. - bool selective_authentication = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The target DNS server IP addresses which can resolve the remote domain - // involved in the trust. - repeated string target_dns_ip_addresses = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. The trust secret used for the handshake with the target domain. This will - // not be stored. - string trust_handshake_secret = 6 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the trust. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the trust, if available. - string state_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last heartbeat time when the trust was known to be connected. - google.protobuf.Timestamp last_trust_heartbeat_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.attach_trust.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.attach_trust.js deleted file mode 100644 index 8157700..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.attach_trust.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, trust) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust resource. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callAttachTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.attachTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAttachTrust(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js deleted file mode 100644 index d9d02d6..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.create_microsoft_ad_domain.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, domainName, domain) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource project name and location using the form: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Required. The fully qualified domain name. - * e.g. mydomain.myorganization.com, with the following restrictions: - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segement length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - */ - // const domainName = 'abc123' - /** - * Required. A Managed Identity domain resource. - */ - // const domain = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callCreateMicrosoftAdDomain() { - // Construct request - const request = { - parent, - domainName, - domain, - }; - - // Run request - const [operation] = await managedidentitiesClient.createMicrosoftAdDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMicrosoftAdDomain(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.delete_domain.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.delete_domain.js deleted file mode 100644 index 1791a8d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.delete_domain.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callDeleteDomain() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await managedidentitiesClient.deleteDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteDomain(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.detach_trust.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.detach_trust.js deleted file mode 100644 index d8867cb..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.detach_trust.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, trust) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust resource to removed. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callDetachTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.detachTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDetachTrust(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.get_domain.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.get_domain.js deleted file mode 100644 index 8324929..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.get_domain.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callGetDomain() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await managedidentitiesClient.getDomain(request); - console.log(response); - } - - callGetDomain(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.list_domains.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.list_domains.js deleted file mode 100644 index bdc9df4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.list_domains.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * next_page_token google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token - * to determine if there are additional results to list. - */ - // const pageSize = 1234 - /** - * Optional. The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - */ - // const pageToken = 'abc123' - /** - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - */ - // const filter = 'abc123' - /** - * Optional. Specifies the ordering of results. See - * Sorting - * order (https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - */ - // const orderBy = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callListDomains() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await managedidentitiesClient.listDomainsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDomains(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js deleted file mode 100644 index 03efc16..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reconfigure_trust.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, targetDomainName, targetDnsIpAddresses) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The fully-qualified target domain name which will be in trust with current - * domain. - */ - // const targetDomainName = 'abc123' - /** - * Required. The target DNS server IP addresses to resolve the remote domain involved - * in the trust. - */ - // const targetDnsIpAddresses = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callReconfigureTrust() { - // Construct request - const request = { - name, - targetDomainName, - targetDnsIpAddresses, - }; - - // Run request - const [operation] = await managedidentitiesClient.reconfigureTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callReconfigureTrust(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js deleted file mode 100644 index 22c87da..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.reset_admin_password.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callResetAdminPassword() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await managedidentitiesClient.resetAdminPassword(request); - console.log(response); - } - - callResetAdminPassword(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.update_domain.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.update_domain.js deleted file mode 100644 index 565b63c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.update_domain.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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(updateMask, domain) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include - * fields from Domain google.cloud.managedidentities.v1.Domain: - * * `labels` - * * `locations` - * * `authorized_networks` - */ - // const updateMask = {} - /** - * Required. Domain message with updated fields. Only supported fields specified in - * update_mask are updated. - */ - // const domain = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callUpdateDomain() { - // Construct request - const request = { - updateMask, - domain, - }; - - // Run request - const [operation] = await managedidentitiesClient.updateDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateDomain(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.validate_trust.js b/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.validate_trust.js deleted file mode 100644 index e59267a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/managed_identities_service.validate_trust.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, trust) { - // [START managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust to validate trust state for. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callValidateTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.validateTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callValidateTrust(); - // [END managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.managedidentities.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.managedidentities.v1.json deleted file mode 100644 index d57a3a0..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.managedidentities.v1.json +++ /dev/null @@ -1,463 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-managedidentities", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.managedidentities.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async", - "title": "ManagedIdentitiesService createMicrosoftAdDomain Sample", - "origin": "API_DEFINITION", - "description": " Creates a Microsoft AD domain.", - "canonical": true, - "file": "managed_identities_service.create_microsoft_ad_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMicrosoftAdDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.CreateMicrosoftAdDomain", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "domain_name", - "type": "TYPE_STRING" - }, - { - "name": "domain", - "type": ".google.cloud.managedidentities.v1.Domain" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "CreateMicrosoftAdDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.CreateMicrosoftAdDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async", - "title": "ManagedIdentitiesService resetAdminPassword Sample", - "origin": "API_DEFINITION", - "description": " Resets a domain's administrator password.", - "canonical": true, - "file": "managed_identities_service.reset_admin_password.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetAdminPassword", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ResetAdminPassword", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1.ResetAdminPasswordResponse", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ResetAdminPassword", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ResetAdminPassword", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async", - "title": "ManagedIdentitiesService listDomains Sample", - "origin": "API_DEFINITION", - "description": " Lists domains in a project.", - "canonical": true, - "file": "managed_identities_service.list_domains.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDomains", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ListDomains", - "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" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1.ListDomainsResponse", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ListDomains", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ListDomains", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async", - "title": "ManagedIdentitiesService getDomain Sample", - "origin": "API_DEFINITION", - "description": " Gets information about a domain.", - "canonical": true, - "file": "managed_identities_service.get_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.GetDomain", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1.Domain", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "GetDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.GetDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async", - "title": "ManagedIdentitiesService updateDomain Sample", - "origin": "API_DEFINITION", - "description": " Updates the metadata and configuration of a domain.", - "canonical": true, - "file": "managed_identities_service.update_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.UpdateDomain", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "domain", - "type": ".google.cloud.managedidentities.v1.Domain" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "UpdateDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.UpdateDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async", - "title": "ManagedIdentitiesService deleteDomain Sample", - "origin": "API_DEFINITION", - "description": " Deletes a domain.", - "canonical": true, - "file": "managed_identities_service.delete_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DeleteDomain", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "DeleteDomain", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DeleteDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async", - "title": "ManagedIdentitiesService attachTrust Sample", - "origin": "API_DEFINITION", - "description": " Adds an AD trust to a domain.", - "canonical": true, - "file": "managed_identities_service.attach_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AttachTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.AttachTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "AttachTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.AttachTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async", - "title": "ManagedIdentitiesService reconfigureTrust Sample", - "origin": "API_DEFINITION", - "description": " Updates the DNS conditional forwarder.", - "canonical": true, - "file": "managed_identities_service.reconfigure_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReconfigureTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ReconfigureTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "target_domain_name", - "type": "TYPE_STRING" - }, - { - "name": "target_dns_ip_addresses", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ReconfigureTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ReconfigureTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async", - "title": "ManagedIdentitiesService detachTrust Sample", - "origin": "API_DEFINITION", - "description": " Removes an AD trust.", - "canonical": true, - "file": "managed_identities_service.detach_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DetachTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DetachTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "DetachTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.DetachTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async", - "title": "ManagedIdentitiesService validateTrust Sample", - "origin": "API_DEFINITION", - "description": " Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.", - "canonical": true, - "file": "managed_identities_service.validate_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ValidateTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ValidateTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ValidateTrust", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService.ValidateTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1.ManagedIdentitiesService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 89968bc..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 v1 from './v1'; -const ManagedIdentitiesServiceClient = v1.ManagedIdentitiesServiceClient; -type ManagedIdentitiesServiceClient = v1.ManagedIdentitiesServiceClient; -export {v1, ManagedIdentitiesServiceClient}; -export default {v1, ManagedIdentitiesServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index f9a5a08..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.managedidentities.v1", - "libraryPackage": "@google-cloud/managed-identities", - "services": { - "ManagedIdentitiesService": { - "clients": { - "grpc": { - "libraryClient": "ManagedIdentitiesServiceClient", - "rpcs": { - "ResetAdminPassword": { - "methods": [ - "resetAdminPassword" - ] - }, - "GetDomain": { - "methods": [ - "getDomain" - ] - }, - "CreateMicrosoftAdDomain": { - "methods": [ - "createMicrosoftAdDomain" - ] - }, - "UpdateDomain": { - "methods": [ - "updateDomain" - ] - }, - "DeleteDomain": { - "methods": [ - "deleteDomain" - ] - }, - "AttachTrust": { - "methods": [ - "attachTrust" - ] - }, - "ReconfigureTrust": { - "methods": [ - "reconfigureTrust" - ] - }, - "DetachTrust": { - "methods": [ - "detachTrust" - ] - }, - "ValidateTrust": { - "methods": [ - "validateTrust" - ] - }, - "ListDomains": { - "methods": [ - "listDomains", - "listDomainsStream", - "listDomainsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ManagedIdentitiesServiceClient", - "rpcs": { - "ResetAdminPassword": { - "methods": [ - "resetAdminPassword" - ] - }, - "GetDomain": { - "methods": [ - "getDomain" - ] - }, - "CreateMicrosoftAdDomain": { - "methods": [ - "createMicrosoftAdDomain" - ] - }, - "UpdateDomain": { - "methods": [ - "updateDomain" - ] - }, - "DeleteDomain": { - "methods": [ - "deleteDomain" - ] - }, - "AttachTrust": { - "methods": [ - "attachTrust" - ] - }, - "ReconfigureTrust": { - "methods": [ - "reconfigureTrust" - ] - }, - "DetachTrust": { - "methods": [ - "detachTrust" - ] - }, - "ValidateTrust": { - "methods": [ - "validateTrust" - ] - }, - "ListDomains": { - "methods": [ - "listDomains", - "listDomainsStream", - "listDomainsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index a6d30bc..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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. ** - -export {ManagedIdentitiesServiceClient} from './managed_identities_service_client'; diff --git a/owl-bot-staging/v1/src/v1/managed_identities_service_client.ts b/owl-bot-staging/v1/src/v1/managed_identities_service_client.ts deleted file mode 100644 index 8d03b92..0000000 --- a/owl-bot-staging/v1/src/v1/managed_identities_service_client.ts +++ /dev/null @@ -1,1581 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/managed_identities_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './managed_identities_service_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * API Overview - * - * The `managedidentites.googleapis.com` service implements the Google Cloud - * Managed Identites API for identity services - * (e.g. Microsoft Active Directory). - * - * The Managed Identities service provides methods to manage - * (create/read/update/delete) domains, reset managed identities admin password, - * add/remove domain controllers in GCP regions and add/remove VPC peering. - * - * Data Model - * - * The Managed Identities service exposes the following resources: - * - * * Locations as global, named as follows: - * `projects/{project_id}/locations/global`. - * - * * Domains, named as follows: - * `/projects/{project_id}/locations/global/domain/{domain_name}`. - * - * The `{domain_name}` refers to fully qualified domain name in the customer - * project e.g. mydomain.myorganization.com, with the following restrictions: - * - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segement length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - * @class - * @memberof v1 - */ -export class ManagedIdentitiesServiceClient { - 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; - managedIdentitiesServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ManagedIdentitiesServiceClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ManagedIdentitiesServiceClient; - 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); - - // 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // 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 = { - domainPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/domains/{domain}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listDomains: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'domains') - }; - - 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.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/domains/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/domains/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/domains/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/global/operations}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const createMicrosoftAdDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const updateDomainResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const updateDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const deleteDomainResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const attachTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const attachTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const reconfigureTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const reconfigureTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const detachTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const detachTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - const validateTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.Domain') as gax.protobuf.Type; - const validateTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1.OpMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createMicrosoftAdDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMicrosoftAdDomainResponse.decode.bind(createMicrosoftAdDomainResponse), - createMicrosoftAdDomainMetadata.decode.bind(createMicrosoftAdDomainMetadata)), - updateDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateDomainResponse.decode.bind(updateDomainResponse), - updateDomainMetadata.decode.bind(updateDomainMetadata)), - deleteDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteDomainResponse.decode.bind(deleteDomainResponse), - deleteDomainMetadata.decode.bind(deleteDomainMetadata)), - attachTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - attachTrustResponse.decode.bind(attachTrustResponse), - attachTrustMetadata.decode.bind(attachTrustMetadata)), - reconfigureTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - reconfigureTrustResponse.decode.bind(reconfigureTrustResponse), - reconfigureTrustMetadata.decode.bind(reconfigureTrustMetadata)), - detachTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - detachTrustResponse.decode.bind(detachTrustResponse), - detachTrustMetadata.decode.bind(detachTrustMetadata)), - validateTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - validateTrustResponse.decode.bind(validateTrustResponse), - validateTrustMetadata.decode.bind(validateTrustMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.managedidentities.v1.ManagedIdentitiesService', 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 = gax.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.managedIdentitiesServiceStub) { - return this.managedIdentitiesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.managedidentities.v1.ManagedIdentitiesService. - this.managedIdentitiesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.managedidentities.v1.ManagedIdentitiesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.managedidentities.v1.ManagedIdentitiesService, - 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 managedIdentitiesServiceStubMethods = - ['createMicrosoftAdDomain', 'resetAdminPassword', 'listDomains', 'getDomain', 'updateDomain', 'deleteDomain', 'attachTrust', 'reconfigureTrust', 'detachTrust', 'validateTrust']; - for (const methodName of managedIdentitiesServiceStubMethods) { - const callPromise = this.managedIdentitiesServiceStub.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.innerApiCalls[methodName] = apiCall; - } - - return this.managedIdentitiesServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'managedidentities.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 'managedidentities.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' - ]; - } - - 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 -- - // ------------------- -/** - * Resets a domain's administrator password. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @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 [ResetAdminPasswordResponse]{@link google.cloud.managedidentities.v1.ResetAdminPasswordResponse}. - * 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/v1/managed_identities_service.reset_admin_password.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ResetAdminPassword_async - */ - resetAdminPassword( - request?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|undefined, {}|undefined - ]>; - resetAdminPassword( - request: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): void; - resetAdminPassword( - request: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, - callback: Callback< - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): void; - resetAdminPassword( - request?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1.IResetAdminPasswordRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.resetAdminPassword(request, options, callback); - } -/** - * Gets information about a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @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 [Domain]{@link google.cloud.managedidentities.v1.Domain}. - * 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/v1/managed_identities_service.get_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_GetDomain_async - */ - getDomain( - request?: protos.google.cloud.managedidentities.v1.IGetDomainRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|undefined, {}|undefined - ]>; - getDomain( - request: protos.google.cloud.managedidentities.v1.IGetDomainRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, - {}|null|undefined>): void; - getDomain( - request: protos.google.cloud.managedidentities.v1.IGetDomainRequest, - callback: Callback< - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, - {}|null|undefined>): void; - getDomain( - request?: protos.google.cloud.managedidentities.v1.IGetDomainRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.managedidentities.v1.IDomain, - protos.google.cloud.managedidentities.v1.IGetDomainRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getDomain(request, options, callback); - } - -/** - * Creates a Microsoft AD domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource project name and location using the form: - * `projects/{project_id}/locations/global` - * @param {string} request.domainName - * Required. The fully qualified domain name. - * e.g. mydomain.myorganization.com, with the following restrictions: - * - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segement length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - * @param {google.cloud.managedidentities.v1.Domain} request.domain - * Required. A Managed Identity domain resource. - * @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/v1/managed_identities_service.create_microsoft_ad_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async - */ - createMicrosoftAdDomain( - request?: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMicrosoftAdDomain( - request: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMicrosoftAdDomain( - request: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMicrosoftAdDomain( - request?: protos.google.cloud.managedidentities.v1.ICreateMicrosoftAdDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createMicrosoftAdDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMicrosoftAdDomain()`. - * @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/v1/managed_identities_service.create_microsoft_ad_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async - */ - async checkCreateMicrosoftAdDomainProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createMicrosoftAdDomain, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the metadata and configuration of a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include - * fields from {@link google.cloud.managedidentities.v1.Domain|Domain}: - * * `labels` - * * `locations` - * * `authorized_networks` - * @param {google.cloud.managedidentities.v1.Domain} request.domain - * Required. Domain message with updated fields. Only supported fields specified in - * update_mask are updated. - * @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/v1/managed_identities_service.update_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async - */ - updateDomain( - request?: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateDomain( - request: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDomain( - request: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDomain( - request?: protos.google.cloud.managedidentities.v1.IUpdateDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'domain.name': request.domain!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateDomain()`. - * @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/v1/managed_identities_service.update_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_UpdateDomain_async - */ - async checkUpdateDomainProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateDomain, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @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/v1/managed_identities_service.delete_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async - */ - deleteDomain( - request?: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteDomain( - request: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDomain( - request: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDomain( - request?: protos.google.cloud.managedidentities.v1.IDeleteDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteDomain()`. - * @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/v1/managed_identities_service.delete_domain.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DeleteDomain_async - */ - async checkDeleteDomainProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteDomain, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Adds an AD trust to a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1.Trust} request.trust - * Required. The domain trust resource. - * @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/v1/managed_identities_service.attach_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async - */ - attachTrust( - request?: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - attachTrust( - request: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - attachTrust( - request: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - attachTrust( - request?: protos.google.cloud.managedidentities.v1.IAttachTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.attachTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `attachTrust()`. - * @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/v1/managed_identities_service.attach_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_AttachTrust_async - */ - async checkAttachTrustProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.attachTrust, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the DNS conditional forwarder. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {string} request.targetDomainName - * Required. The fully-qualified target domain name which will be in trust with current - * domain. - * @param {string[]} request.targetDnsIpAddresses - * Required. The target DNS server IP addresses to resolve the remote domain involved - * in the trust. - * @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/v1/managed_identities_service.reconfigure_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async - */ - reconfigureTrust( - request?: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - reconfigureTrust( - request: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reconfigureTrust( - request: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reconfigureTrust( - request?: protos.google.cloud.managedidentities.v1.IReconfigureTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.reconfigureTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `reconfigureTrust()`. - * @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/v1/managed_identities_service.reconfigure_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ReconfigureTrust_async - */ - async checkReconfigureTrustProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.reconfigureTrust, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes an AD trust. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1.Trust} request.trust - * Required. The domain trust resource to removed. - * @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/v1/managed_identities_service.detach_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async - */ - detachTrust( - request?: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - detachTrust( - request: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - detachTrust( - request: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - detachTrust( - request?: protos.google.cloud.managedidentities.v1.IDetachTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.detachTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `detachTrust()`. - * @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/v1/managed_identities_service.detach_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_DetachTrust_async - */ - async checkDetachTrustProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.detachTrust, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Validates a trust state, that the target domain is reachable, and that the - * target domain is able to accept incoming trust requests. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1.Trust} request.trust - * Required. The domain trust to validate trust state for. - * @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/v1/managed_identities_service.validate_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async - */ - validateTrust( - request?: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - validateTrust( - request: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateTrust( - request: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateTrust( - request?: protos.google.cloud.managedidentities.v1.IValidateTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.validateTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `validateTrust()`. - * @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/v1/managed_identities_service.validate_trust.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ValidateTrust_async - */ - async checkValidateTrustProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.validateTrust, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists domains in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} [request.filter] - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} [request.orderBy] - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 [Domain]{@link google.cloud.managedidentities.v1.Domain}. - * 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 `listDomainsAsync()` - * 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. - */ - listDomains( - request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1.IDomain[], - protos.google.cloud.managedidentities.v1.IListDomainsRequest|null, - protos.google.cloud.managedidentities.v1.IListDomainsResponse - ]>; - listDomains( - request: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.managedidentities.v1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1.IDomain>): void; - listDomains( - request: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - callback: PaginationCallback< - protos.google.cloud.managedidentities.v1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1.IDomain>): void; - listDomains( - request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.managedidentities.v1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1.IDomain>, - callback?: PaginationCallback< - protos.google.cloud.managedidentities.v1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1.IDomain>): - Promise<[ - protos.google.cloud.managedidentities.v1.IDomain[], - protos.google.cloud.managedidentities.v1.IListDomainsRequest|null, - protos.google.cloud.managedidentities.v1.IListDomainsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listDomains(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 domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} [request.filter] - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} [request.orderBy] - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 [Domain]{@link google.cloud.managedidentities.v1.Domain} 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 `listDomainsAsync()` - * 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. - */ - listDomainsStream( - request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listDomains']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDomains.createStream( - this.innerApiCalls.listDomains as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDomains`, 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 domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} [request.pageSize] - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} [request.filter] - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} [request.orderBy] - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 - * [Domain]{@link google.cloud.managedidentities.v1.Domain}. 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/v1/managed_identities_service.list_domains.js - * region_tag:managedidentities_v1_generated_ManagedIdentitiesService_ListDomains_async - */ - listDomainsAsync( - request?: protos.google.cloud.managedidentities.v1.IListDomainsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listDomains']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDomains.asyncIterate( - this.innerApiCalls['listDomains'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified domain resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} domain - * @returns {string} Resource name string. - */ - domainPath(project:string,location:string,domain:string) { - return this.pathTemplates.domainPathTemplate.render({ - project: project, - location: location, - domain: domain, - }); - } - - /** - * Parse the project from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).project; - } - - /** - * Parse the location from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the location. - */ - matchLocationFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).location; - } - - /** - * Parse the domain from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the domain. - */ - matchDomainFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).domain; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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; - } - - /** - * 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.managedIdentitiesServiceStub && !this._terminated) { - return this.managedIdentitiesServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/managed_identities_service_client_config.json b/owl-bot-staging/v1/src/v1/managed_identities_service_client_config.json deleted file mode 100644 index 96889cb..0000000 --- a/owl-bot-staging/v1/src/v1/managed_identities_service_client_config.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "interfaces": { - "google.cloud.managedidentities.v1.ManagedIdentitiesService": { - "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": { - "CreateMicrosoftAdDomain": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetAdminPassword": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDomains": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDomain": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDomain": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDomain": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AttachTrust": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReconfigureTrust": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DetachTrust": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ValidateTrust": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/managed_identities_service_proto_list.json b/owl-bot-staging/v1/src/v1/managed_identities_service_proto_list.json deleted file mode 100644 index 6200ede..0000000 --- a/owl-bot-staging/v1/src/v1/managed_identities_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/managedidentities/v1/managed_identities_service.proto", - "../../protos/google/cloud/managedidentities/v1/resource.proto" -] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 026805f..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const managedidentities = require('@google-cloud/managed-identities'); - -function main() { - const managedIdentitiesServiceClient = new managedidentities.ManagedIdentitiesServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 041ef62..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 {ManagedIdentitiesServiceClient} from '@google-cloud/managed-identities'; - -// check that the client class type name can be used -function doStuffWithManagedIdentitiesServiceClient(client: ManagedIdentitiesServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const managedIdentitiesServiceClient = new ManagedIdentitiesServiceClient(); - doStuffWithManagedIdentitiesServiceClient(managedIdentitiesServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_managed_identities_service_v1.ts b/owl-bot-staging/v1/test/gapic_managed_identities_service_v1.ts deleted file mode 100644 index 0b1ab16..0000000 --- a/owl-bot-staging/v1/test/gapic_managed_identities_service_v1.ts +++ /dev/null @@ -1,1744 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentitiesserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -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('v1.ManagedIdentitiesServiceClient', () => { - it('has servicePath', () => { - const servicePath = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.managedIdentitiesServiceStub, undefined); - await client.initialize(); - assert(client.managedIdentitiesServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.managedIdentitiesServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.managedIdentitiesServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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 managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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('resetAdminPassword', () => { - it('invokes resetAdminPassword without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse()); - client.innerApiCalls.resetAdminPassword = stubSimpleCall(expectedResponse); - const [response] = await client.resetAdminPassword(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes resetAdminPassword without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordResponse()); - client.innerApiCalls.resetAdminPassword = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetAdminPassword( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IResetAdminPasswordResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes resetAdminPassword with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.resetAdminPassword = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resetAdminPassword(request), expectedError); - assert((client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes resetAdminPassword with closed client', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ResetAdminPasswordRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.resetAdminPassword(request), expectedError); - }); - }); - - describe('getDomain', () => { - it('invokes getDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.GetDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()); - client.innerApiCalls.getDomain = stubSimpleCall(expectedResponse); - const [response] = await client.getDomain(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.GetDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()); - client.innerApiCalls.getDomain = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDomain( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IDomain|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getDomain with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.GetDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getDomain = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDomain(request), expectedError); - assert((client.innerApiCalls.getDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getDomain with closed client', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.GetDomainRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDomain(request), expectedError); - }); - }); - - describe('createMicrosoftAdDomain', () => { - it('invokes createMicrosoftAdDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMicrosoftAdDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createMicrosoftAdDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMicrosoftAdDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createMicrosoftAdDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMicrosoftAdDomain(request), expectedError); - assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createMicrosoftAdDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMicrosoftAdDomain(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateMicrosoftAdDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkCreateMicrosoftAdDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMicrosoftAdDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkCreateMicrosoftAdDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateDomain', () => { - it('invokes updateDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.UpdateDomainRequest()); - request.domain = {}; - request.domain.name = ''; - const expectedHeaderRequestParams = "domain.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.UpdateDomainRequest()); - request.domain = {}; - request.domain.name = ''; - const expectedHeaderRequestParams = "domain.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.UpdateDomainRequest()); - request.domain = {}; - request.domain.name = ''; - const expectedHeaderRequestParams = "domain.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDomain(request), expectedError); - assert((client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.UpdateDomainRequest()); - request.domain = {}; - request.domain.name = ''; - const expectedHeaderRequestParams = "domain.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDomain(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkUpdateDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkUpdateDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteDomain', () => { - it('invokes deleteDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DeleteDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DeleteDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DeleteDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDomain(request), expectedError); - assert((client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DeleteDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDomain(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkDeleteDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkDeleteDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('attachTrust', () => { - it('invokes attachTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.AttachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.attachTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.attachTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes attachTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.AttachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.attachTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.attachTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes attachTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.AttachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.attachTrust(request), expectedError); - assert((client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes attachTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.AttachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.attachTrust(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkAttachTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkAttachTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAttachTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkAttachTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('reconfigureTrust', () => { - it('invokes reconfigureTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.reconfigureTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes reconfigureTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.reconfigureTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reconfigureTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes reconfigureTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.reconfigureTrust(request), expectedError); - assert((client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes reconfigureTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ReconfigureTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.reconfigureTrust(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkReconfigureTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkReconfigureTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkReconfigureTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkReconfigureTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('detachTrust', () => { - it('invokes detachTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DetachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.detachTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.detachTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes detachTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DetachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.detachTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.detachTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes detachTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DetachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.detachTrust(request), expectedError); - assert((client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes detachTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.DetachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.detachTrust(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDetachTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkDetachTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDetachTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkDetachTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('validateTrust', () => { - it('invokes validateTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ValidateTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.validateTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.validateTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes validateTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ValidateTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.validateTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.validateTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes validateTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ValidateTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.validateTrust(request), expectedError); - assert((client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes validateTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ValidateTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.validateTrust(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkValidateTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkValidateTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkValidateTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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.checkValidateTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listDomains', () => { - it('invokes listDomains without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - ]; - client.innerApiCalls.listDomains = stubSimpleCall(expectedResponse); - const [response] = await client.listDomains(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listDomains as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listDomains without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - ]; - client.innerApiCalls.listDomains = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDomains( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1.IDomain[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listDomains as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listDomains with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listDomains = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDomains(request), expectedError); - assert((client.innerApiCalls.listDomains as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listDomainsStream without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - ]; - client.descriptors.page.listDomains.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDomainsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.managedidentities.v1.Domain[] = []; - stream.on('data', (response: protos.google.cloud.managedidentities.v1.Domain) => { - 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.listDomains.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); - assert.strictEqual( - (client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listDomainsStream with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listDomains.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDomainsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.managedidentities.v1.Domain[] = []; - stream.on('data', (response: protos.google.cloud.managedidentities.v1.Domain) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); - assert.strictEqual( - (client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listDomains without error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1.Domain()), - ]; - client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.managedidentities.v1.IDomain[] = []; - const iterable = client.listDomainsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listDomains with error', async () => { - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDomainsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.managedidentities.v1.IDomain[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('domain', () => { - const fakePath = "/rendered/path/domain"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - domain: "domainValue", - }; - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.domainPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.domainPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('domainPath', () => { - const result = client.domainPath("projectValue", "locationValue", "domainValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.domainPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDomainName', () => { - const result = client.matchProjectFromDomainName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDomainName', () => { - const result = client.matchLocationFromDomainName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDomainFromDomainName', () => { - const result = client.matchDomainFromDomainName(fakePath); - assert.strictEqual(result, "domainValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new managedidentitiesserviceModule.v1.ManagedIdentitiesServiceClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index 934d701..0000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ManagedIdentitiesService', - filename: './managed-identities-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js deleted file mode 100644 index df287d2..0000000 --- a/owl-bot-staging/v1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/managed-identities', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md deleted file mode 100644 index 94f33d6..0000000 --- a/owl-bot-staging/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Managedidentities: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v1beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json deleted file mode 100644 index 887d031..0000000 --- a/owl-bot-staging/v1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/managed-identities", - "version": "0.1.0", - "description": "Managedidentities client for Node.js", - "repository": "googleapis/nodejs-managedidentities", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google managedidentities", - "managedidentities", - "managed identities service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto b/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto deleted file mode 100644 index 17bc165..0000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright 2021 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.managedidentities.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/managedidentities/v1beta1/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ManagedIdentities.V1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1beta1;managedidentities"; -option java_multiple_files = true; -option java_outer_classname = "ManagedIdentitiesServiceProto"; -option java_package = "com.google.cloud.managedidentities.v1beta1"; -option objc_class_prefix = "GCMI"; -option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1beta1"; -option ruby_package = "Google::Cloud::ManagedIdentities::V1beta1"; - -service ManagedIdentitiesService { - option (google.api.default_host) = "managedidentities.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a Microsoft AD domain. - rpc CreateMicrosoftAdDomain(CreateMicrosoftAdDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/global}/domains" - body: "domain" - }; - option (google.api.method_signature) = "parent,domain_name,domain"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Resets a domain's administrator password. - rpc ResetAdminPassword(ResetAdminPasswordRequest) returns (ResetAdminPasswordResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:resetAdminPassword" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Lists domains in a project. - rpc ListDomains(ListDomainsRequest) returns (ListDomainsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/global}/domains" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information about a domain. - rpc GetDomain(GetDomainRequest) returns (Domain) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/global/domains/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the metadata and configuration of a domain. - rpc UpdateDomain(UpdateDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{domain.name=projects/*/locations/global/domains/*}" - body: "domain" - }; - option (google.api.method_signature) = "domain,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Deletes a domain. - rpc DeleteDomain(DeleteDomainRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/global/domains/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OpMetadata" - }; - } - - // Adds an AD trust to a domain. - rpc AttachTrust(AttachTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:attachTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Updates the DNS conditional forwarder. - rpc ReconfigureTrust(ReconfigureTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:reconfigureTrust" - body: "*" - }; - option (google.api.method_signature) = "name,target_domain_name,target_dns_ip_addresses"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Removes an AD trust. - rpc DetachTrust(DetachTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:detachTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } - - // Validates a trust state, that the target domain is reachable, and that the - // target domain is able to accept incoming trust requests. - rpc ValidateTrust(ValidateTrustRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/global/domains/*}:validateTrust" - body: "*" - }; - option (google.api.method_signature) = "name,trust"; - option (google.longrunning.operation_info) = { - response_type: "Domain" - metadata_type: "OpMetadata" - }; - } -} - -// Represents the metadata of the long-running operation. -message OpMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for -// [CreateMicrosoftAdDomain][google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomain] -message CreateMicrosoftAdDomainRequest { - // Required. The resource project name and location using the form: - // `projects/{project_id}/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: - // * Must contain only lowercase letters, numbers, periods and hyphens. - // * Must start with a letter. - // * Must contain between 2-64 characters. - // * Must end with a number or a letter. - // * Must not start with period. - // * First segment length (mydomain form example above) shouldn't exceed - // 15 chars. - // * The last segment cannot be fully numeric. - // * Must be unique within the customer project. - string domain_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Managed Identity domain resource. - Domain domain = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ResetAdminPassword][google.cloud.managedidentities.v1beta1.ResetAdminPassword] -message ResetAdminPasswordRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Response message for -// [ResetAdminPassword][google.cloud.managedidentities.v1beta1.ResetAdminPassword] -message ResetAdminPasswordResponse { - // A random password. See [admin][google.cloud.managedidentities.v1beta1.Domain.admin] for more information. - string password = 1; -} - -// Request message for -// [ListDomains][google.cloud.managedidentities.v1beta1.ListDomains] -message ListDomainsRequest { - // Required. The resource name of the domain location using the form: - // `projects/{project_id}/locations/global` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Optional. The maximum number of items to return. - // If not specified, a default value of 1000 will be used. - // Regardless of the page_size value, the response may include a partial list. - // Callers should rely on a response's - // [next_page_token][google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token] - // to determine if there are additional results to list. - int32 page_size = 2; - - // The `next_page_token` value returned from a previous ListDomainsRequest - // request, if any. - string page_token = 3; - - // Optional. A filter specifying constraints of a list operation. - // For example, `Domain.fqdn="mydomain.myorginization"`. - string filter = 4; - - // Optional. Specifies the ordering of results. See - // [Sorting - // order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - // for more information. - string order_by = 5; -} - -// Response message for -// [ListDomains][google.cloud.managedidentities.v1beta1.ListDomains] -message ListDomainsResponse { - // A list of Managed Identities Service domains in the project. - repeated Domain domains = 1; - - // A token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; - - // A list of locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [GetDomain][google.cloud.managedidentities.v1beta1.GetDomain] -message GetDomainRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Request message for -// [UpdateDomain][google.cloud.managedidentities.v1beta1.UpdateDomain] -message UpdateDomainRequest { - // Required. Mask of fields to update. At least one path must be supplied in this - // field. The elements of the repeated paths field may only include - // fields from [Domain][google.cloud.managedidentities.v1beta1.Domain]: - // * `labels` - // * `locations` - // * `authorized_networks` - // * `audit_logs_enabled` - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Domain message with updated fields. Only supported fields specified in - // update_mask are updated. - Domain domain = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [DeleteDomain][google.cloud.managedidentities.v1beta1.DeleteDomain] -message DeleteDomainRequest { - // Required. The domain resource name using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; -} - -// Request message for -// [AttachTrust][google.cloud.managedidentities.v1beta1.AttachTrust] -message AttachTrustRequest { - // Required. The resource domain name, project name and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust resource. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ReconfigureTrust][google.cloud.managedidentities.v1beta1.ReconfigureTrust] -message ReconfigureTrustRequest { - // Required. The resource domain name, project name and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The fully-qualified target domain name which will be in trust with current - // domain. - string target_domain_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The target DNS server IP addresses to resolve the remote domain involved - // in the trust. - repeated string target_dns_ip_addresses = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [DetachTrust][google.cloud.managedidentities.v1beta1.DetachTrust] -message DetachTrustRequest { - // Required. The resource domain name, project name, and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust resource to removed. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ValidateTrust][google.cloud.managedidentities.v1beta1.ValidateTrust] -message ValidateTrustRequest { - // Required. The resource domain name, project name, and location using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "managedidentities.googleapis.com/Domain" - } - ]; - - // Required. The domain trust to validate trust state for. - Trust trust = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto b/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto deleted file mode 100644 index a733e1c..0000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/managedidentities/v1beta1/resource.proto +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright 2021 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.managedidentities.v1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.ManagedIdentities.V1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1beta1;managedidentities"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.cloud.managedidentities.v1beta1"; -option php_namespace = "Google\\Cloud\\ManagedIdentities\\V1beta1"; -option ruby_package = "Google::Cloud::ManagedIdentities::V1beta1"; - -// Represents a managed Microsoft Active Directory domain. -// If the domain is being changed, it will be placed into the UPDATING state, -// which indicates that the resource is being reconciled. At this point, Get -// will reflect an intermediate state. -message Domain { - option (google.api.resource) = { - type: "managedidentities.googleapis.com/Domain" - pattern: "projects/{project}/locations/{location}/domains/{domain}" - }; - - // Represents the different states of a managed domain. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The domain is being created. - CREATING = 1; - - // The domain has been created and is fully usable. - READY = 2; - - // The domain's configuration is being updated. - UPDATING = 3; - - // The domain is being deleted. - DELETING = 4; - - // The domain is being repaired and may be unusable. Details - // can be found in the `status_message` field. - REPAIRING = 5; - - // The domain is undergoing maintenance. - PERFORMING_MAINTENANCE = 6; - - // The domain is not serving requests. - UNAVAILABLE = 7; - } - - // Output only. The unique name of the domain using the form: - // `projects/{project_id}/locations/global/domains/{domain_name}`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Resource labels that can contain user-provided metadata. - map labels = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The full names of the Google Compute Engine - // [networks](/compute/docs/networks-and-firewalls#networks) the domain - // instance is connected to. Networks can be added using UpdateDomain. - // The domain is only available on networks listed in `authorized_networks`. - // If CIDR subnets overlap between networks, domain creation will fail. - repeated string authorized_networks = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The CIDR range of internal addresses that are reserved for this - // domain. Reserved networks must be /24 or larger. Ranges must be - // unique and non-overlapping with existing subnets in - // [Domain].[authorized_networks]. - string reserved_ip_range = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Locations where domain needs to be provisioned. - // [regions][compute/docs/regions-zones/] - // e.g. us-west1 or us-east4 - // Service supports up to 4 locations at once. Each location will use a /26 - // block. - repeated string locations = 5 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The name of delegated administrator account used to perform - // Active Directory operations. If not specified, `setupadmin` will be used. - string admin = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The fully-qualified domain name of the exposed domain used by - // clients to connect to the service. Similar to what would be chosen for an - // Active Directory set up on an internal network. - string fqdn = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time. - google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of this domain. - State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current status of this - // domain, if available. - string status_message = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current trusts associated with the domain. - repeated Trust trusts = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a relationship between two domains. This allows a controller in -// one domain to authenticate a user in another domain. -message Trust { - // Represents the different states of a domain trust. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // The domain trust is being created. - CREATING = 1; - - // The domain trust is being updated. - UPDATING = 2; - - // The domain trust is being deleted. - DELETING = 3; - - // The domain trust is connected. - CONNECTED = 4; - - // The domain trust is disconnected. - DISCONNECTED = 5; - } - - // Represents the different inter-forest trust types. - enum TrustType { - // Not set. - TRUST_TYPE_UNSPECIFIED = 0; - - // The forest trust. - FOREST = 1; - - // The external domain trust. - EXTERNAL = 2; - } - - // Represents the direction of trust. - // See - // [System.DirectoryServices.ActiveDirectory.TrustDirection](https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.trustdirection?view=netframework-4.7.2) - // for more information. - enum TrustDirection { - // Not set. - TRUST_DIRECTION_UNSPECIFIED = 0; - - // The inbound direction represents the trusting side. - INBOUND = 1; - - // The outboud direction represents the trusted side. - OUTBOUND = 2; - - // The bidirectional direction represents the trusted / trusting side. - BIDIRECTIONAL = 3; - } - - // The fully qualified target domain name which will be in trust with the - // current domain. - string target_domain_name = 1; - - // The type of trust represented by the trust resource. - TrustType trust_type = 2; - - // The trust direction, which decides if the current domain is trusted, - // trusting, or both. - TrustDirection trust_direction = 3; - - // The trust authentication type, which decides whether the trusted side has - // forest/domain wide access or selective access to an approved set of - // resources. - bool selective_authentication = 4; - - // The target DNS server IP addresses which can resolve the remote domain - // involved in the trust. - repeated string target_dns_ip_addresses = 5; - - // Input only. The trust secret used for the handshake - // with the target domain. It will not be stored. - string trust_handshake_secret = 6 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the trust. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // trust, if available. - string state_description = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last heartbeat time when the trust was known to be - // connected. - google.protobuf.Timestamp last_trust_heartbeat_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js deleted file mode 100644 index 326fa3c..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.attach_trust.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, trust) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust resource. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callAttachTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.attachTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAttachTrust(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js deleted file mode 100644 index f9df294..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.create_microsoft_ad_domain.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, domainName, domain) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource project name and location using the form: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segment length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - */ - // const domainName = 'abc123' - /** - * Required. A Managed Identity domain resource. - */ - // const domain = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callCreateMicrosoftAdDomain() { - // Construct request - const request = { - parent, - domainName, - domain, - }; - - // Run request - const [operation] = await managedidentitiesClient.createMicrosoftAdDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMicrosoftAdDomain(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js deleted file mode 100644 index 67d86ef..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.delete_domain.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callDeleteDomain() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await managedidentitiesClient.deleteDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteDomain(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js deleted file mode 100644 index 392c6bf..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.detach_trust.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, trust) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust resource to removed. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callDetachTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.detachTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDetachTrust(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js deleted file mode 100644 index b9f6c89..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.get_domain.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callGetDomain() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await managedidentitiesClient.getDomain(request); - console.log(response); - } - - callGetDomain(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js deleted file mode 100644 index eafe434..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.list_domains.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * next_page_token google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token - * to determine if there are additional results to list. - */ - // const pageSize = 1234 - /** - * The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - */ - // const pageToken = 'abc123' - /** - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - */ - // const filter = 'abc123' - /** - * Optional. Specifies the ordering of results. See - * Sorting - * order (https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - */ - // const orderBy = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callListDomains() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await managedidentitiesClient.listDomainsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDomains(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js deleted file mode 100644 index a597883..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reconfigure_trust.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, targetDomainName, targetDnsIpAddresses) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The fully-qualified target domain name which will be in trust with current - * domain. - */ - // const targetDomainName = 'abc123' - /** - * Required. The target DNS server IP addresses to resolve the remote domain involved - * in the trust. - */ - // const targetDnsIpAddresses = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callReconfigureTrust() { - // Construct request - const request = { - name, - targetDomainName, - targetDnsIpAddresses, - }; - - // Run request - const [operation] = await managedidentitiesClient.reconfigureTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callReconfigureTrust(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js deleted file mode 100644 index baabacb..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.reset_admin_password.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callResetAdminPassword() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await managedidentitiesClient.resetAdminPassword(request); - console.log(response); - } - - callResetAdminPassword(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js deleted file mode 100644 index e99ea24..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.update_domain.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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(updateMask, domain) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include - * fields from Domain google.cloud.managedidentities.v1beta1.Domain: - * * `labels` - * * `locations` - * * `authorized_networks` - * * `audit_logs_enabled` - */ - // const updateMask = {} - /** - * Required. Domain message with updated fields. Only supported fields specified in - * update_mask are updated. - */ - // const domain = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callUpdateDomain() { - // Construct request - const request = { - updateMask, - domain, - }; - - // Run request - const [operation] = await managedidentitiesClient.updateDomain(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateDomain(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js deleted file mode 100644 index eb48db2..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/managed_identities_service.validate_trust.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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, trust) { - // [START managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - */ - // const name = 'abc123' - /** - * Required. The domain trust to validate trust state for. - */ - // const trust = {} - - // Imports the Managedidentities library - const {ManagedIdentitiesServiceClient} = require('@google-cloud/managed-identities').v1beta1; - - // Instantiates a client - const managedidentitiesClient = new ManagedIdentitiesServiceClient(); - - async function callValidateTrust() { - // Construct request - const request = { - name, - trust, - }; - - // Run request - const [operation] = await managedidentitiesClient.validateTrust(request); - const [response] = await operation.promise(); - console.log(response); - } - - callValidateTrust(); - // [END managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.managedidentities.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.managedidentities.v1beta1.json deleted file mode 100644 index d55e495..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.managedidentities.v1beta1.json +++ /dev/null @@ -1,463 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-managedidentities", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.managedidentities.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async", - "title": "ManagedIdentitiesService createMicrosoftAdDomain Sample", - "origin": "API_DEFINITION", - "description": " Creates a Microsoft AD domain.", - "canonical": true, - "file": "managed_identities_service.create_microsoft_ad_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMicrosoftAdDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.CreateMicrosoftAdDomain", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "domain_name", - "type": "TYPE_STRING" - }, - { - "name": "domain", - "type": ".google.cloud.managedidentities.v1beta1.Domain" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "CreateMicrosoftAdDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.CreateMicrosoftAdDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async", - "title": "ManagedIdentitiesService resetAdminPassword Sample", - "origin": "API_DEFINITION", - "description": " Resets a domain's administrator password.", - "canonical": true, - "file": "managed_identities_service.reset_admin_password.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetAdminPassword", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ResetAdminPassword", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ResetAdminPassword", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ResetAdminPassword", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async", - "title": "ManagedIdentitiesService listDomains Sample", - "origin": "API_DEFINITION", - "description": " Lists domains in a project.", - "canonical": true, - "file": "managed_identities_service.list_domains.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDomains", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ListDomains", - "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" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1beta1.ListDomainsResponse", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ListDomains", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ListDomains", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async", - "title": "ManagedIdentitiesService getDomain Sample", - "origin": "API_DEFINITION", - "description": " Gets information about a domain.", - "canonical": true, - "file": "managed_identities_service.get_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.GetDomain", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.managedidentities.v1beta1.Domain", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "GetDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.GetDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async", - "title": "ManagedIdentitiesService updateDomain Sample", - "origin": "API_DEFINITION", - "description": " Updates the metadata and configuration of a domain.", - "canonical": true, - "file": "managed_identities_service.update_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.UpdateDomain", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "domain", - "type": ".google.cloud.managedidentities.v1beta1.Domain" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "UpdateDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.UpdateDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async", - "title": "ManagedIdentitiesService deleteDomain Sample", - "origin": "API_DEFINITION", - "description": " Deletes a domain.", - "canonical": true, - "file": "managed_identities_service.delete_domain.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DeleteDomain", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "DeleteDomain", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DeleteDomain", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async", - "title": "ManagedIdentitiesService attachTrust Sample", - "origin": "API_DEFINITION", - "description": " Adds an AD trust to a domain.", - "canonical": true, - "file": "managed_identities_service.attach_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AttachTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.AttachTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1beta1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "AttachTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.AttachTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async", - "title": "ManagedIdentitiesService reconfigureTrust Sample", - "origin": "API_DEFINITION", - "description": " Updates the DNS conditional forwarder.", - "canonical": true, - "file": "managed_identities_service.reconfigure_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReconfigureTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ReconfigureTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "target_domain_name", - "type": "TYPE_STRING" - }, - { - "name": "target_dns_ip_addresses", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ReconfigureTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ReconfigureTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async", - "title": "ManagedIdentitiesService detachTrust Sample", - "origin": "API_DEFINITION", - "description": " Removes an AD trust.", - "canonical": true, - "file": "managed_identities_service.detach_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DetachTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DetachTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1beta1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "DetachTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.DetachTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - }, - { - "regionTag": "managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async", - "title": "ManagedIdentitiesService validateTrust Sample", - "origin": "API_DEFINITION", - "description": " Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.", - "canonical": true, - "file": "managed_identities_service.validate_trust.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ValidateTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ValidateTrust", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "trust", - "type": ".google.cloud.managedidentities.v1beta1.Trust" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ManagedIdentitiesServiceClient", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClient" - }, - "method": { - "shortName": "ValidateTrust", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService.ValidateTrust", - "service": { - "shortName": "ManagedIdentitiesService", - "fullName": "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts deleted file mode 100644 index 131c914..0000000 --- a/owl-bot-staging/v1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 v1beta1 from './v1beta1'; -const ManagedIdentitiesServiceClient = v1beta1.ManagedIdentitiesServiceClient; -type ManagedIdentitiesServiceClient = v1beta1.ManagedIdentitiesServiceClient; -export {v1beta1, ManagedIdentitiesServiceClient}; -export default {v1beta1, ManagedIdentitiesServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 7566a4e..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.managedidentities.v1beta1", - "libraryPackage": "@google-cloud/managed-identities", - "services": { - "ManagedIdentitiesService": { - "clients": { - "grpc": { - "libraryClient": "ManagedIdentitiesServiceClient", - "rpcs": { - "ResetAdminPassword": { - "methods": [ - "resetAdminPassword" - ] - }, - "GetDomain": { - "methods": [ - "getDomain" - ] - }, - "CreateMicrosoftAdDomain": { - "methods": [ - "createMicrosoftAdDomain" - ] - }, - "UpdateDomain": { - "methods": [ - "updateDomain" - ] - }, - "DeleteDomain": { - "methods": [ - "deleteDomain" - ] - }, - "AttachTrust": { - "methods": [ - "attachTrust" - ] - }, - "ReconfigureTrust": { - "methods": [ - "reconfigureTrust" - ] - }, - "DetachTrust": { - "methods": [ - "detachTrust" - ] - }, - "ValidateTrust": { - "methods": [ - "validateTrust" - ] - }, - "ListDomains": { - "methods": [ - "listDomains", - "listDomainsStream", - "listDomainsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ManagedIdentitiesServiceClient", - "rpcs": { - "ResetAdminPassword": { - "methods": [ - "resetAdminPassword" - ] - }, - "GetDomain": { - "methods": [ - "getDomain" - ] - }, - "CreateMicrosoftAdDomain": { - "methods": [ - "createMicrosoftAdDomain" - ] - }, - "UpdateDomain": { - "methods": [ - "updateDomain" - ] - }, - "DeleteDomain": { - "methods": [ - "deleteDomain" - ] - }, - "AttachTrust": { - "methods": [ - "attachTrust" - ] - }, - "ReconfigureTrust": { - "methods": [ - "reconfigureTrust" - ] - }, - "DetachTrust": { - "methods": [ - "detachTrust" - ] - }, - "ValidateTrust": { - "methods": [ - "validateTrust" - ] - }, - "ListDomains": { - "methods": [ - "listDomains", - "listDomainsStream", - "listDomainsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index a6d30bc..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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. ** - -export {ManagedIdentitiesServiceClient} from './managed_identities_service_client'; diff --git a/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client.ts deleted file mode 100644 index b227ff3..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client.ts +++ /dev/null @@ -1,1548 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/managed_identities_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './managed_identities_service_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta1 - */ -export class ManagedIdentitiesServiceClient { - 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; - managedIdentitiesServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ManagedIdentitiesServiceClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ManagedIdentitiesServiceClient; - 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); - - // 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // 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 = { - domainPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/domains/{domain}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // 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 = { - listDomains: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'domains') - }; - - 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.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=projects/*/locations/global/domains/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy',},{get: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/global/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/global/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/global/operations}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const createMicrosoftAdDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const updateDomainResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const updateDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const deleteDomainResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteDomainMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const attachTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const attachTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const reconfigureTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const reconfigureTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const detachTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const detachTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - const validateTrustResponse = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.Domain') as gax.protobuf.Type; - const validateTrustMetadata = protoFilesRoot.lookup( - '.google.cloud.managedidentities.v1beta1.OpMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createMicrosoftAdDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMicrosoftAdDomainResponse.decode.bind(createMicrosoftAdDomainResponse), - createMicrosoftAdDomainMetadata.decode.bind(createMicrosoftAdDomainMetadata)), - updateDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateDomainResponse.decode.bind(updateDomainResponse), - updateDomainMetadata.decode.bind(updateDomainMetadata)), - deleteDomain: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteDomainResponse.decode.bind(deleteDomainResponse), - deleteDomainMetadata.decode.bind(deleteDomainMetadata)), - attachTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - attachTrustResponse.decode.bind(attachTrustResponse), - attachTrustMetadata.decode.bind(attachTrustMetadata)), - reconfigureTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - reconfigureTrustResponse.decode.bind(reconfigureTrustResponse), - reconfigureTrustMetadata.decode.bind(reconfigureTrustMetadata)), - detachTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - detachTrustResponse.decode.bind(detachTrustResponse), - detachTrustMetadata.decode.bind(detachTrustMetadata)), - validateTrust: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - validateTrustResponse.decode.bind(validateTrustResponse), - validateTrustMetadata.decode.bind(validateTrustMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.managedidentities.v1beta1.ManagedIdentitiesService', 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 = gax.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.managedIdentitiesServiceStub) { - return this.managedIdentitiesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.managedidentities.v1beta1.ManagedIdentitiesService. - this.managedIdentitiesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.managedidentities.v1beta1.ManagedIdentitiesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.managedidentities.v1beta1.ManagedIdentitiesService, - 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 managedIdentitiesServiceStubMethods = - ['createMicrosoftAdDomain', 'resetAdminPassword', 'listDomains', 'getDomain', 'updateDomain', 'deleteDomain', 'attachTrust', 'reconfigureTrust', 'detachTrust', 'validateTrust']; - for (const methodName of managedIdentitiesServiceStubMethods) { - const callPromise = this.managedIdentitiesServiceStub.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.innerApiCalls[methodName] = apiCall; - } - - return this.managedIdentitiesServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'managedidentities.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 'managedidentities.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' - ]; - } - - 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 -- - // ------------------- -/** - * Resets a domain's administrator password. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @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 [ResetAdminPasswordResponse]{@link google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse}. - * 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/v1beta1/managed_identities_service.reset_admin_password.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ResetAdminPassword_async - */ - resetAdminPassword( - request?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|undefined, {}|undefined - ]>; - resetAdminPassword( - request: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): void; - resetAdminPassword( - request: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, - callback: Callback< - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): void; - resetAdminPassword( - request?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse, - protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.resetAdminPassword(request, options, callback); - } -/** - * Gets information about a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @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 [Domain]{@link google.cloud.managedidentities.v1beta1.Domain}. - * 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/v1beta1/managed_identities_service.get_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_GetDomain_async - */ - getDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|undefined, {}|undefined - ]>; - getDomain( - request: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, - {}|null|undefined>): void; - getDomain( - request: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, - callback: Callback< - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, - {}|null|undefined>): void; - getDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IDomain, - protos.google.cloud.managedidentities.v1beta1.IGetDomainRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getDomain(request, options, callback); - } - -/** - * Creates a Microsoft AD domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource project name and location using the form: - * `projects/{project_id}/locations/global` - * @param {string} request.domainName - * Required. A domain name, e.g. mydomain.myorg.com, with the following restrictions: - * * Must contain only lowercase letters, numbers, periods and hyphens. - * * Must start with a letter. - * * Must contain between 2-64 characters. - * * Must end with a number or a letter. - * * Must not start with period. - * * First segment length (mydomain form example above) shouldn't exceed - * 15 chars. - * * The last segment cannot be fully numeric. - * * Must be unique within the customer project. - * @param {google.cloud.managedidentities.v1beta1.Domain} request.domain - * Required. A Managed Identity domain resource. - * @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/v1beta1/managed_identities_service.create_microsoft_ad_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async - */ - createMicrosoftAdDomain( - request?: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMicrosoftAdDomain( - request: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMicrosoftAdDomain( - request: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMicrosoftAdDomain( - request?: protos.google.cloud.managedidentities.v1beta1.ICreateMicrosoftAdDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createMicrosoftAdDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMicrosoftAdDomain()`. - * @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/v1beta1/managed_identities_service.create_microsoft_ad_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_CreateMicrosoftAdDomain_async - */ - async checkCreateMicrosoftAdDomainProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createMicrosoftAdDomain, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the metadata and configuration of a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include - * fields from {@link google.cloud.managedidentities.v1beta1.Domain|Domain}: - * * `labels` - * * `locations` - * * `authorized_networks` - * * `audit_logs_enabled` - * @param {google.cloud.managedidentities.v1beta1.Domain} request.domain - * Required. Domain message with updated fields. Only supported fields specified in - * update_mask are updated. - * @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/v1beta1/managed_identities_service.update_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async - */ - updateDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateDomain( - request: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDomain( - request: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IUpdateDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'domain.name': request.domain!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateDomain()`. - * @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/v1beta1/managed_identities_service.update_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_UpdateDomain_async - */ - async checkUpdateDomainProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateDomain, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The domain resource name using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @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/v1beta1/managed_identities_service.delete_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async - */ - deleteDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteDomain( - request: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDomain( - request: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteDomain( - request?: protos.google.cloud.managedidentities.v1beta1.IDeleteDomainRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteDomain(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteDomain()`. - * @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/v1beta1/managed_identities_service.delete_domain.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DeleteDomain_async - */ - async checkDeleteDomainProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteDomain, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Adds an AD trust to a domain. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust - * Required. The domain trust resource. - * @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/v1beta1/managed_identities_service.attach_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async - */ - attachTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - attachTrust( - request: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - attachTrust( - request: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - attachTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IAttachTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.attachTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `attachTrust()`. - * @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/v1beta1/managed_identities_service.attach_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_AttachTrust_async - */ - async checkAttachTrustProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.attachTrust, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the DNS conditional forwarder. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {string} request.targetDomainName - * Required. The fully-qualified target domain name which will be in trust with current - * domain. - * @param {string[]} request.targetDnsIpAddresses - * Required. The target DNS server IP addresses to resolve the remote domain involved - * in the trust. - * @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/v1beta1/managed_identities_service.reconfigure_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async - */ - reconfigureTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - reconfigureTrust( - request: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reconfigureTrust( - request: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reconfigureTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IReconfigureTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.reconfigureTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `reconfigureTrust()`. - * @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/v1beta1/managed_identities_service.reconfigure_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ReconfigureTrust_async - */ - async checkReconfigureTrustProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.reconfigureTrust, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Removes an AD trust. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust - * Required. The domain trust resource to removed. - * @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/v1beta1/managed_identities_service.detach_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async - */ - detachTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - detachTrust( - request: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - detachTrust( - request: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - detachTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IDetachTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.detachTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `detachTrust()`. - * @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/v1beta1/managed_identities_service.detach_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_DetachTrust_async - */ - async checkDetachTrustProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.detachTrust, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Validates a trust state, that the target domain is reachable, and that the - * target domain is able to accept incoming trust requests. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource domain name, project name, and location using the form: - * `projects/{project_id}/locations/global/domains/{domain_name}` - * @param {google.cloud.managedidentities.v1beta1.Trust} request.trust - * Required. The domain trust to validate trust state for. - * @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/v1beta1/managed_identities_service.validate_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async - */ - validateTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - validateTrust( - request: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateTrust( - request: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - validateTrust( - request?: protos.google.cloud.managedidentities.v1beta1.IValidateTrustRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.validateTrust(request, options, callback); - } -/** - * Check the status of the long running operation returned by `validateTrust()`. - * @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/v1beta1/managed_identities_service.validate_trust.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ValidateTrust_async - */ - async checkValidateTrustProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.validateTrust, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists domains in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} request.filter - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} request.orderBy - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 [Domain]{@link google.cloud.managedidentities.v1beta1.Domain}. - * 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 `listDomainsAsync()` - * 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. - */ - listDomains( - request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IDomain[], - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest|null, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse - ]>; - listDomains( - request: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1beta1.IDomain>): void; - listDomains( - request: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - callback: PaginationCallback< - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1beta1.IDomain>): void; - listDomains( - request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1beta1.IDomain>, - callback?: PaginationCallback< - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse|null|undefined, - protos.google.cloud.managedidentities.v1beta1.IDomain>): - Promise<[ - protos.google.cloud.managedidentities.v1beta1.IDomain[], - protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest|null, - protos.google.cloud.managedidentities.v1beta1.IListDomainsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listDomains(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 domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} request.filter - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} request.orderBy - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 [Domain]{@link google.cloud.managedidentities.v1beta1.Domain} 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 `listDomainsAsync()` - * 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. - */ - listDomainsStream( - request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listDomains']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDomains.createStream( - this.innerApiCalls.listDomains as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDomains`, 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 domain location using the form: - * `projects/{project_id}/locations/global` - * @param {number} request.pageSize - * Optional. The maximum number of items to return. - * If not specified, a default value of 1000 will be used. - * Regardless of the page_size value, the response may include a partial list. - * Callers should rely on a response's - * {@link google.cloud.managedidentities.v1beta1.ListDomainsResponse.next_page_token|next_page_token} - * to determine if there are additional results to list. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous ListDomainsRequest - * request, if any. - * @param {string} request.filter - * Optional. A filter specifying constraints of a list operation. - * For example, `Domain.fqdn="mydomain.myorginization"`. - * @param {string} request.orderBy - * Optional. Specifies the ordering of results. See - * [Sorting - * order](https://cloud.google.com/apis/design/design_patterns#sorting_order) - * for more information. - * @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 - * [Domain]{@link google.cloud.managedidentities.v1beta1.Domain}. 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/v1beta1/managed_identities_service.list_domains.js - * region_tag:managedidentities_v1beta1_generated_ManagedIdentitiesService_ListDomains_async - */ - listDomainsAsync( - request?: protos.google.cloud.managedidentities.v1beta1.IListDomainsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listDomains']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDomains.asyncIterate( - this.innerApiCalls['listDomains'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified domain resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} domain - * @returns {string} Resource name string. - */ - domainPath(project:string,location:string,domain:string) { - return this.pathTemplates.domainPathTemplate.render({ - project: project, - location: location, - domain: domain, - }); - } - - /** - * Parse the project from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).project; - } - - /** - * Parse the location from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the location. - */ - matchLocationFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).location; - } - - /** - * Parse the domain from Domain resource. - * - * @param {string} domainName - * A fully-qualified path representing Domain resource. - * @returns {string} A string representing the domain. - */ - matchDomainFromDomainName(domainName: string) { - return this.pathTemplates.domainPathTemplate.match(domainName).domain; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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; - } - - /** - * 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.managedIdentitiesServiceStub && !this._terminated) { - return this.managedIdentitiesServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client_config.json deleted file mode 100644 index c863d5e..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_client_config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.cloud.managedidentities.v1beta1.ManagedIdentitiesService": { - "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": { - "CreateMicrosoftAdDomain": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetAdminPassword": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDomains": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDomain": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDomain": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDomain": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AttachTrust": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReconfigureTrust": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DetachTrust": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ValidateTrust": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_proto_list.json deleted file mode 100644 index dbe4729..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/managed_identities_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/managedidentities/v1beta1/managed_identities_service.proto", - "../../protos/google/cloud/managedidentities/v1beta1/resource.proto" -] diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 026805f..0000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const managedidentities = require('@google-cloud/managed-identities'); - -function main() { - const managedIdentitiesServiceClient = new managedidentities.ManagedIdentitiesServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 041ef62..0000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 {ManagedIdentitiesServiceClient} from '@google-cloud/managed-identities'; - -// check that the client class type name can be used -function doStuffWithManagedIdentitiesServiceClient(client: ManagedIdentitiesServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const managedIdentitiesServiceClient = new ManagedIdentitiesServiceClient(); - doStuffWithManagedIdentitiesServiceClient(managedIdentitiesServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1beta1/test/gapic_managed_identities_service_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_managed_identities_service_v1beta1.ts deleted file mode 100644 index f430592..0000000 --- a/owl-bot-staging/v1beta1/test/gapic_managed_identities_service_v1beta1.ts +++ /dev/null @@ -1,1744 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// 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 managedidentitiesserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -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('v1beta1.ManagedIdentitiesServiceClient', () => { - it('has servicePath', () => { - const servicePath = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.managedIdentitiesServiceStub, undefined); - await client.initialize(); - assert(client.managedIdentitiesServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.managedIdentitiesServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.managedIdentitiesServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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 managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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('resetAdminPassword', () => { - it('invokes resetAdminPassword without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse()); - client.innerApiCalls.resetAdminPassword = stubSimpleCall(expectedResponse); - const [response] = await client.resetAdminPassword(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes resetAdminPassword without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordResponse()); - client.innerApiCalls.resetAdminPassword = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetAdminPassword( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IResetAdminPasswordResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes resetAdminPassword with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.resetAdminPassword = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resetAdminPassword(request), expectedError); - assert((client.innerApiCalls.resetAdminPassword as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes resetAdminPassword with closed client', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ResetAdminPasswordRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.resetAdminPassword(request), expectedError); - }); - }); - - describe('getDomain', () => { - it('invokes getDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()); - client.innerApiCalls.getDomain = stubSimpleCall(expectedResponse); - const [response] = await client.getDomain(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()); - client.innerApiCalls.getDomain = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDomain( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IDomain|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getDomain with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getDomain = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDomain(request), expectedError); - assert((client.innerApiCalls.getDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getDomain with closed client', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.GetDomainRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDomain(request), expectedError); - }); - }); - - describe('createMicrosoftAdDomain', () => { - it('invokes createMicrosoftAdDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMicrosoftAdDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createMicrosoftAdDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMicrosoftAdDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createMicrosoftAdDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMicrosoftAdDomain(request), expectedError); - assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createMicrosoftAdDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.CreateMicrosoftAdDomainRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createMicrosoftAdDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMicrosoftAdDomain(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createMicrosoftAdDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateMicrosoftAdDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkCreateMicrosoftAdDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMicrosoftAdDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkCreateMicrosoftAdDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateDomain', () => { - it('invokes updateDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest()); - request.domain = {}; - request.domain.name = ''; - const expectedHeaderRequestParams = "domain.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest()); - request.domain = {}; - request.domain.name = ''; - const expectedHeaderRequestParams = "domain.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest()); - request.domain = {}; - request.domain.name = ''; - const expectedHeaderRequestParams = "domain.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDomain(request), expectedError); - assert((client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.UpdateDomainRequest()); - request.domain = {}; - request.domain.name = ''; - const expectedHeaderRequestParams = "domain.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDomain(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkUpdateDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkUpdateDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteDomain', () => { - it('invokes deleteDomain without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteDomain = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteDomain(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteDomain without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteDomain = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDomain( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteDomain with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDomain(request), expectedError); - assert((client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteDomain with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DeleteDomainRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDomain = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDomain(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteDomain as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteDomainProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkDeleteDomainProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteDomainProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkDeleteDomainProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('attachTrust', () => { - it('invokes attachTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.attachTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.attachTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes attachTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.attachTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.attachTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes attachTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.attachTrust(request), expectedError); - assert((client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes attachTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.AttachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.attachTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.attachTrust(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.attachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkAttachTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkAttachTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAttachTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkAttachTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('reconfigureTrust', () => { - it('invokes reconfigureTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.reconfigureTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes reconfigureTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.reconfigureTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reconfigureTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes reconfigureTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.reconfigureTrust(request), expectedError); - assert((client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes reconfigureTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ReconfigureTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.reconfigureTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.reconfigureTrust(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.reconfigureTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkReconfigureTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkReconfigureTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkReconfigureTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkReconfigureTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('detachTrust', () => { - it('invokes detachTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.detachTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.detachTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes detachTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.detachTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.detachTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes detachTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.detachTrust(request), expectedError); - assert((client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes detachTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.DetachTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.detachTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.detachTrust(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.detachTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDetachTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkDetachTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDetachTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkDetachTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('validateTrust', () => { - it('invokes validateTrust without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.validateTrust = stubLongRunningCall(expectedResponse); - const [operation] = await client.validateTrust(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes validateTrust without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.validateTrust = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.validateTrust( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes validateTrust with call error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.validateTrust(request), expectedError); - assert((client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes validateTrust with LRO error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ValidateTrustRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.validateTrust = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.validateTrust(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.validateTrust as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkValidateTrustProgress without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkValidateTrustProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkValidateTrustProgress with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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.checkValidateTrustProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listDomains', () => { - it('invokes listDomains without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - ]; - client.innerApiCalls.listDomains = stubSimpleCall(expectedResponse); - const [response] = await client.listDomains(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listDomains as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listDomains without error using callback', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - ]; - client.innerApiCalls.listDomains = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDomains( - request, - (err?: Error|null, result?: protos.google.cloud.managedidentities.v1beta1.IDomain[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listDomains as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listDomains with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listDomains = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDomains(request), expectedError); - assert((client.innerApiCalls.listDomains as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listDomainsStream without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - ]; - client.descriptors.page.listDomains.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDomainsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.managedidentities.v1beta1.Domain[] = []; - stream.on('data', (response: protos.google.cloud.managedidentities.v1beta1.Domain) => { - 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.listDomains.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); - assert.strictEqual( - (client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listDomainsStream with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listDomains.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDomainsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.managedidentities.v1beta1.Domain[] = []; - stream.on('data', (response: protos.google.cloud.managedidentities.v1beta1.Domain) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDomains, request)); - assert.strictEqual( - (client.descriptors.page.listDomains.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listDomains without error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.Domain()), - ]; - client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.managedidentities.v1beta1.IDomain[] = []; - const iterable = client.listDomainsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listDomains with error', async () => { - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.managedidentities.v1beta1.ListDomainsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listDomains.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDomainsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.managedidentities.v1beta1.IDomain[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listDomains.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('domain', () => { - const fakePath = "/rendered/path/domain"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - domain: "domainValue", - }; - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.domainPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.domainPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('domainPath', () => { - const result = client.domainPath("projectValue", "locationValue", "domainValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.domainPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDomainName', () => { - const result = client.matchProjectFromDomainName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDomainName', () => { - const result = client.matchLocationFromDomainName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDomainFromDomainName', () => { - const result = client.matchDomainFromDomainName(fakePath); - assert.strictEqual(result, "domainValue"); - assert((client.pathTemplates.domainPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new managedidentitiesserviceModule.v1beta1.ManagedIdentitiesServiceClient({ - 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)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js deleted file mode 100644 index 934d701..0000000 --- a/owl-bot-staging/v1beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ManagedIdentitiesService', - filename: './managed-identities-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/src/v1/managed_identities_service_client.ts b/src/v1/managed_identities_service_client.ts index 641cf48..d89afe7 100644 --- a/src/v1/managed_identities_service_client.ts +++ b/src/v1/managed_identities_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -103,7 +104,7 @@ export class ManagedIdentitiesServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -126,11 +127,10 @@ export class ManagedIdentitiesServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -221,16 +221,87 @@ export class ManagedIdentitiesServiceClient { }; 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.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/global/domains/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/global/domains/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/global/domains/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/global/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/global/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/global/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/global/operations}', + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( '.google.cloud.managedidentities.v1.Domain' diff --git a/src/v1beta1/managed_identities_service_client.ts b/src/v1beta1/managed_identities_service_client.ts index 5986e2f..715cb3f 100644 --- a/src/v1beta1/managed_identities_service_client.ts +++ b/src/v1beta1/managed_identities_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -71,7 +72,7 @@ export class ManagedIdentitiesServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -94,11 +95,10 @@ export class ManagedIdentitiesServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -189,16 +189,87 @@ export class ManagedIdentitiesServiceClient { }; 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.cloud.location.Locations.GetLocation', + get: '/v1beta1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1beta1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1beta1/{resource=projects/*/locations/global/domains/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:getIamPolicy', + }, + { + get: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1beta1/{resource=projects/*/locations/global/domains/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1beta1/{resource=projects/*/locations/global/peerings/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1beta1/{resource=projects/*/locations/global/domains/*/backups/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1beta1/{name=projects/*/locations/global/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1beta1/{name=projects/*/locations/global/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1beta1/{name=projects/*/locations/global/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1beta1/{name=projects/*/locations/global/operations}', + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createMicrosoftAdDomainResponse = protoFilesRoot.lookup( '.google.cloud.managedidentities.v1beta1.Domain'