From d17356a36253883d0b6b368b852e8fc9ce1d246d Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:32:14 +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 + .../cloud/common/operation_metadata.proto | 53 + .../v1/cloud_filestore_service.proto | 718 ++++++ .../cloud_filestore_manager.create_backup.js | 76 + ...cloud_filestore_manager.create_instance.js | 72 + .../cloud_filestore_manager.delete_backup.js | 60 + ...cloud_filestore_manager.delete_instance.js | 60 + .../v1/cloud_filestore_manager.get_backup.js | 59 + .../cloud_filestore_manager.get_instance.js | 59 + .../cloud_filestore_manager.list_backups.js | 82 + .../cloud_filestore_manager.list_instances.js | 81 + ...loud_filestore_manager.restore_instance.js | 71 + .../cloud_filestore_manager.update_backup.js | 65 + ...cloud_filestore_manager.update_instance.js | 67 + ...et_metadata.google.cloud.filestore.v1.json | 519 +++++ owl-bot-staging/v1/src/index.ts | 25 + .../src/v1/cloud_filestore_manager_client.ts | 1784 ++++++++++++++ ...cloud_filestore_manager_client_config.json | 93 + .../cloud_filestore_manager_proto_list.json | 4 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 141 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../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 + .../test/gapic_cloud_filestore_manager_v1.ts | 1987 ++++++++++++++++ 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 + .../cloud/common/operation_metadata.proto | 53 + .../v1beta1/cloud_filestore_service.proto | 766 +++++++ .../cloud_filestore_manager.create_backup.js | 74 + ...cloud_filestore_manager.create_instance.js | 74 + .../cloud_filestore_manager.delete_backup.js | 60 + ...cloud_filestore_manager.delete_instance.js | 60 + .../cloud_filestore_manager.get_backup.js | 59 + .../cloud_filestore_manager.get_instance.js | 59 + .../cloud_filestore_manager.list_backups.js | 82 + .../cloud_filestore_manager.list_instances.js | 81 + ...loud_filestore_manager.restore_instance.js | 76 + .../cloud_filestore_manager.update_backup.js | 65 + ...cloud_filestore_manager.update_instance.js | 69 + ...tadata.google.cloud.filestore.v1beta1.json | 523 +++++ owl-bot-staging/v1beta1/src/index.ts | 25 + .../v1beta1/cloud_filestore_manager_client.ts | 1856 +++++++++++++++ ...cloud_filestore_manager_client_config.json | 93 + .../cloud_filestore_manager_proto_list.json | 4 + .../v1beta1/src/v1beta1/gapic_metadata.json | 141 ++ owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + .../gapic_cloud_filestore_manager_v1beta1.ts | 2041 +++++++++++++++++ owl-bot-staging/v1beta1/tsconfig.json | 19 + owl-bot-staging/v1beta1/webpack.config.js | 64 + 70 files changed, 13187 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/common/operation_metadata.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/filestore/v1/cloud_filestore_service.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_backup.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_backup.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_backup.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_backups.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_instances.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.restore_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_backup.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.filestore.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/cloud_filestore_manager_client.ts create mode 100644 owl-bot-staging/v1/src/v1/cloud_filestore_manager_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/cloud_filestore_manager_proto_list.json 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/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_cloud_filestore_manager_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/common/operation_metadata.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_backup.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_instance.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_backup.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_instance.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_backup.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_instance.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_backups.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_instances.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.restore_instance.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_backup.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_instance.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.filestore.v1beta1.json create mode 100644 owl-bot-staging/v1beta1/src/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client_config.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_proto_list.json 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/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_cloud_filestore_manager_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..52876d4 --- /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/filestore', + 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..048fe77 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Filestore: 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..ff98186 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/filestore", + "version": "0.1.0", + "description": "Filestore client for Node.js", + "repository": "googleapis/nodejs-filestore", + "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 filestore", + "filestore", + "cloud filestore manager" + ], + "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/common/operation_metadata.proto b/owl-bot-staging/v1/protos/google/cloud/common/operation_metadata.proto new file mode 100644 index 0000000..24300e3 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/common/operation_metadata.proto @@ -0,0 +1,53 @@ +// 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.common; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/common;common"; +option java_multiple_files = true; +option java_package = "com.google.cloud.common"; + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // 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. Human-readable status of the operation, if any. + string status_detail = 5 [(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][] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/filestore/v1/cloud_filestore_service.proto b/owl-bot-staging/v1/protos/google/cloud/filestore/v1/cloud_filestore_service.proto new file mode 100644 index 0000000..676fa0b --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/filestore/v1/cloud_filestore_service.proto @@ -0,0 +1,718 @@ +// 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.filestore.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/common/operation_metadata.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Filestore.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/filestore/v1;filestore"; +option java_multiple_files = true; +option java_outer_classname = "CloudFilestoreServiceProto"; +option java_package = "com.google.cloud.filestore.v1"; +option php_namespace = "Google\\Cloud\\Filestore\\V1"; + +// Configures and manages Cloud Filestore resources. +// +// Cloud Filestore Manager v1. +// +// The `file.googleapis.com` service implements the Cloud Filestore API and +// defines the following resource model for managing instances: +// * The service works with a collection of cloud projects, named: `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// * Each location has a collection of instances and backups, named: +// `/instances/*` and `/backups/*` respectively. +// * As such, Cloud Filestore instances are resources of the form: +// `/projects/{project_number}/locations/{location_id}/instances/{instance_id}` +// and backups are resources of the form: +// `/projects/{project_number}/locations/{location_id}/backup/{backup_id}` +// +// Note that location_id must be a GCP `zone` for instances and but to a GCP +// `region` for backups; for example: +// * `projects/12345/locations/us-central1-c/instances/my-filestore` +// * `projects/12345/locations/us-central1/backups/my-backup` +service CloudFilestoreManager { + option (google.api.default_host) = "file.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all instances in a project for either a specified location + // or for all locations. + rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/instances" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a specific instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an instance. + // When creating from a backup, the capacity of the new instance needs to be + // equal to or larger than the capacity of the backup (and also equal to or + // larger than the minimum capacity of the tier). + rpc CreateInstance(CreateInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/instances" + body: "instance" + }; + option (google.api.method_signature) = "parent,instance,instance_id"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Updates the settings of a specific instance. + rpc UpdateInstance(UpdateInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{instance.name=projects/*/locations/*/instances/*}" + body: "instance" + }; + option (google.api.method_signature) = "instance,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Restores an existing instance's file share from a backup. + // + // The capacity of the instance needs to be equal to or larger than the + // capacity of the backup (and also equal to or larger than the minimum + // capacity of the tier). + rpc RestoreInstance(RestoreInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/instances/*}:restore" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Deletes an instance. + rpc DeleteInstance(DeleteInstanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Lists all backups in a project for either a specified location or for all + // locations. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a specific backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a backup. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup,backup_id"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Deletes a backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Updates the settings of a specific backup. + rpc UpdateBackup(UpdateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{backup.name=projects/*/locations/*/backups/*}" + body: "backup" + }; + option (google.api.method_signature) = "backup,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } +} + +// Network configuration for the instance. +message NetworkConfig { + // Internet protocol versions supported by Cloud Filestore. + enum AddressMode { + // Internet protocol not set. + ADDRESS_MODE_UNSPECIFIED = 0; + + // Use the IPv4 internet protocol. + MODE_IPV4 = 1; + } + + // The name of the Google Compute Engine + // [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the + // instance is connected. + string network = 1; + + // Internet protocol versions for which the instance has IP addresses + // assigned. For this version, only MODE_IPV4 is supported. + repeated AddressMode modes = 3; + + // A /29 CIDR block in one of the + // [internal IP address + // ranges](https://www.arin.net/reference/research/statistics/address_filters/) + // that identifies the range of IP addresses reserved for this instance. For + // example, 10.0.0.0/29 or 192.168.0.0/29. The range you specify can't overlap + // with either existing subnets or assigned IP address ranges for other Cloud + // Filestore instances in the selected VPC network. + string reserved_ip_range = 4; + + // Output only. IPv4 addresses in the format + // IPv4 addresses in the format `{octet1}.{octet2}.{octet3}.{octet4}` or + // IPv6 addresses in the format + // `{block1}:{block2}:{block3}:{block4}:{block5}:{block6}:{block7}:{block8}`. + repeated string ip_addresses = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// File share configuration for the instance. +message FileShareConfig { + // The name of the file share (must be 16 characters or less). + string name = 1; + + // File share capacity in gigabytes (GB). + // Cloud Filestore defines 1 GB as 1024^3 bytes. + int64 capacity_gb = 2; + + // The source that this file share has been restored from. Empty if the file + // share is created from scratch. + oneof source { + // The resource name of the backup, in the format + // `projects/{project_number}/locations/{location_id}/backups/{backup_id}`, + // that this file share has been restored from. + string source_backup = 8 [ + (google.api.resource_reference) = { type: "file.googleapis.com/Backup" } + ]; + } + + // Nfs Export Options. + // There is a limit of 10 export options per file share. + repeated NfsExportOptions nfs_export_options = 7; +} + +// NFS export options specifications. +message NfsExportOptions { + // The access mode. + enum AccessMode { + // AccessMode not set. + ACCESS_MODE_UNSPECIFIED = 0; + + // The client can only read the file share. + READ_ONLY = 1; + + // The client can read and write the file share (default). + READ_WRITE = 2; + } + + // The squash mode. + enum SquashMode { + // SquashMode not set. + SQUASH_MODE_UNSPECIFIED = 0; + + // The Root user has root access to the file share (default). + NO_ROOT_SQUASH = 1; + + // The Root user has squashed access to the anonymous uid/gid. + ROOT_SQUASH = 2; + } + + // List of either an IPv4 addresses in the format + // `{octet1}.{octet2}.{octet3}.{octet4}` or CIDR ranges in the format + // `{octet1}.{octet2}.{octet3}.{octet4}/{mask size}` which may mount the + // file share. + // Overlapping IP ranges are not allowed, both within and across + // NfsExportOptions. An error will be returned. + // The limit is 64 IP ranges/addresses for each FileShareConfig among all + // NfsExportOptions. + repeated string ip_ranges = 1; + + // Either READ_ONLY, for allowing only read requests on the exported + // directory, or READ_WRITE, for allowing both read and write requests. + // The default is READ_WRITE. + AccessMode access_mode = 2; + + // Either NO_ROOT_SQUASH, for allowing root access on the exported directory, + // or ROOT_SQUASH, for not allowing root access. The default is + // NO_ROOT_SQUASH. + SquashMode squash_mode = 3; + + // An integer representing the anonymous user id with a default value of + // 65534. + // Anon_uid may only be set with squash_mode of ROOT_SQUASH. An error will be + // returned if this field is specified for other squash_mode settings. + int64 anon_uid = 4; + + // An integer representing the anonymous group id with a default value of + // 65534. + // Anon_gid may only be set with squash_mode of ROOT_SQUASH. An error will be + // returned if this field is specified for other squash_mode settings. + int64 anon_gid = 5; +} + +// A Cloud Filestore instance. +message Instance { + option (google.api.resource) = { + type: "file.googleapis.com/Instance" + pattern: "projects/{project}/locations/{location}/instances/{instance}" + }; + + // The instance state. + enum State { + // State not set. + STATE_UNSPECIFIED = 0; + + // The instance is being created. + CREATING = 1; + + // The instance is available for use. + READY = 2; + + // Work is being done on the instance. You can get further details from the + // `statusMessage` field of the `Instance` resource. + REPAIRING = 3; + + // The instance is shutting down. + DELETING = 4; + + // The instance is experiencing an issue and might be unusable. You can get + // further details from the `statusMessage` field of the `Instance` + // resource. + ERROR = 6; + + // The instance is restoring a backup to an existing file share and may be + // unusable during this time. + RESTORING = 7; + } + + // Available service tiers. + enum Tier { + // Not set. + TIER_UNSPECIFIED = 0; + + // STANDARD tier. + STANDARD = 1; + + // PREMIUM tier. + PREMIUM = 2; + + // BASIC instances offer a maximum capacity of 63.9 TB. + // BASIC_HDD is an alias for STANDARD Tier, offering economical + // performance backed by HDD. + BASIC_HDD = 3; + + // BASIC instances offer a maximum capacity of 63.9 TB. + // BASIC_SSD is an alias for PREMIUM Tier, and offers improved + // performance backed by SSD. + BASIC_SSD = 4; + + // HIGH_SCALE instances offer expanded capacity and performance scaling + // capabilities. + HIGH_SCALE_SSD = 5; + } + + // Output only. The resource name of the instance, in the format + // `projects/{project}/locations/{location}/instances/{instance}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of the instance (2048 characters or less). + string description = 2; + + // Output only. The instance state. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the instance state, if available. + string status_message = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the instance was created. + google.protobuf.Timestamp create_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The service tier of the instance. + Tier tier = 8; + + // Resource labels to represent user provided metadata. + map labels = 9; + + // File system shares on the instance. + // For this version, only a single file share is supported. + repeated FileShareConfig file_shares = 10; + + // VPC networks to which the instance is connected. + // For this version, only a single network is supported. + repeated NetworkConfig networks = 11; + + // Server-specified ETag for the instance resource to prevent simultaneous + // updates from overwriting each other. + string etag = 12; + + // Output only. Reserved for future use. + google.protobuf.BoolValue satisfies_pzs = 13 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// CreateInstanceRequest creates an instance. +message CreateInstanceRequest { + // Required. The instance's project and location, in the format + // `projects/{project_id}/locations/{location}`. In Cloud Filestore, + // locations map to GCP zones, for example **us-west1-b**. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The name of the instance to create. + // The name must be unique for the specified project and location. + string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. An [instance resource][google.cloud.filestore.v1.Instance] + Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// GetInstanceRequest gets the state of an instance. +message GetInstanceRequest { + // Required. The instance resource name, in the format + // `projects/{project_id}/locations/{location}/instances/{instance_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "file.googleapis.com/Instance" } + ]; +} + +// UpdateInstanceRequest updates the settings of an instance. +message UpdateInstanceRequest { + // Mask of fields to update. At least one path must be supplied in this + // field. The elements of the repeated paths field may only include these + // fields: + // + // * "description" + // * "file_shares" + // * "labels" + google.protobuf.FieldMask update_mask = 1; + + // Only fields specified in update_mask are updated. + Instance instance = 2; +} + +// RestoreInstanceRequest restores an existing instances's file share from a +// backup. +message RestoreInstanceRequest { + // Required. The resource name of the instance, in the format + // `projects/{project_number}/locations/{location_id}/instances/{instance_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "file.googleapis.com/Instance" } + ]; + + // Required. Name of the file share in the Cloud Filestore instance that the + // backup is being restored to. + string file_share = 2 [(google.api.field_behavior) = REQUIRED]; + + oneof source { + // The resource name of the backup, in the format + // `projects/{project_number}/locations/{location_id}/backups/{backup_id}`. + string source_backup = 3 [ + (google.api.resource_reference) = { type: "file.googleapis.com/Backup" } + ]; + } +} + +// DeleteInstanceRequest deletes an instance. +message DeleteInstanceRequest { + // Required. The instance resource name, in the format + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "file.googleapis.com/Instance" } + ]; +} + +// ListInstancesRequest lists instances. +message ListInstancesRequest { + // Required. The project and location for which to retrieve instance + // information, in the format `projects/{project_id}/locations/{location}`. In + // Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To + // retrieve instance information for all locations, use "-" for the + // `{location}` value. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value to use if there are additional + // results to retrieve for this list request. + string page_token = 3; + + // Sort results. Supported values are "name", "name desc" or "" (unsorted). + string order_by = 4; + + // List filter. + string filter = 5; +} + +// ListInstancesResponse is the result of ListInstancesRequest. +message ListInstancesResponse { + // A list of instances in the project for the specified location. + // + // If the `{location}` value in the request is "-", the response contains a + // list of instances from all locations. If any location is unreachable, the + // response will only return instances in reachable locations and the + // "unreachable" field will be populated with a list of unreachable locations. + repeated Instance instances = 1; + + // The token you can use to retrieve the next page of results. Not returned + // if there are no more results in the list. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A Cloud Filestore backup. +message Backup { + option (google.api.resource) = { + type: "file.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/backups/{backup}" + }; + + // The backup state. + enum State { + // State not set. + STATE_UNSPECIFIED = 0; + + // Backup is being created. + CREATING = 1; + + // Backup has been taken and the operation is being finalized. At this + // point, changes to the file share will not be reflected in the backup. + FINALIZING = 2; + + // Backup is available for use. + READY = 3; + + // Backup is being deleted. + DELETING = 4; + } + + // Output only. The resource name of the backup, in the format + // `projects/{project_number}/locations/{location_id}/backups/{backup_id}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A description of the backup with 2048 characters or less. + // Requests with longer descriptions will be rejected. + string description = 2; + + // Output only. The backup state. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the backup was created. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Resource labels to represent user provided metadata. + map labels = 5; + + // Output only. Capacity of the source file share when the backup was created. + int64 capacity_gb = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The size of the storage used by the backup. As backups share + // storage, this number is expected to change with backup creation/deletion. + int64 storage_bytes = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The resource name of the source Cloud Filestore instance, in the format + // `projects/{project_number}/locations/{location_id}/instances/{instance_id}`, + // used to create this backup. + string source_instance = 8 [ + (google.api.resource_reference) = { type: "file.googleapis.com/Instance" } + ]; + + // Name of the file share in the source Cloud Filestore instance that the + // backup is created from. + string source_file_share = 9; + + // Output only. The service tier of the source Cloud Filestore instance that + // this backup is created from. + Instance.Tier source_instance_tier = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Amount of bytes that will be downloaded if the backup is + // restored. This may be different than storage bytes, since sequential + // backups of the same disk will share storage. + int64 download_bytes = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Reserved for future use. + google.protobuf.BoolValue satisfies_pzs = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// CreateBackupRequest creates a backup. +message CreateBackupRequest { + // Required. The backup's project and location, in the format + // `projects/{project_number}/locations/{location}`. In Cloud Filestore, + // backup locations map to GCP regions, for example **us-west1**. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. A [backup resource][google.cloud.filestore.v1.Backup] + Backup backup = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the backup. + // The ID must be unique within the specified project and location. + // + // This value must start with a lowercase letter followed by up to 62 + // lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + // Values that do not match this pattern will trigger an INVALID_ARGUMENT + // error. + string backup_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// DeleteBackupRequest deletes a backup. +message DeleteBackupRequest { + // Required. The backup resource name, in the format + // `projects/{project_number}/locations/{location}/backups/{backup_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "file.googleapis.com/Backup" } + ]; +} + +// UpdateBackupRequest updates description and/or labels for a backup. +message UpdateBackupRequest { + // Required. A [backup resource][google.cloud.filestore.v1.Backup] + Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask of fields to update. At least one path must be supplied in + // this field. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// GetBackupRequest gets the state of a backup. +message GetBackupRequest { + // Required. The backup resource name, in the format + // `projects/{project_number}/locations/{location}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "file.googleapis.com/Backup" } + ]; +} + +// ListBackupsRequest lists backups. +message ListBackupsRequest { + // Required. The project and location for which to retrieve backup + // information, in the format + // `projects/{project_number}/locations/{location}`. In Cloud Filestore, + // backup locations map to GCP regions, for example **us-west1**. To retrieve + // backup information for all locations, use "-" for the + // `{location}` value. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value to use if there are additional + // results to retrieve for this list request. + string page_token = 3; + + // Sort results. Supported values are "name", "name desc" or "" (unsorted). + string order_by = 4; + + // List filter. + string filter = 5; +} + +// ListBackupsResponse is the result of ListBackupsRequest. +message ListBackupsResponse { + // A list of backups in the project for the specified location. + // + // If the `{location}` value in the request is "-", the response contains a + // list of backups from all locations. If any location is unreachable, the + // response will only return backups in reachable locations and the + // "unreachable" field will be populated with a list of unreachable + // locations. + repeated Backup backups = 1; + + // The token you can use to retrieve the next page of results. Not returned + // if there are no more results in the list. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_backup.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_backup.js new file mode 100644 index 0000000..522528e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_backup.js @@ -0,0 +1,76 @@ +// 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, backup, backupId) { + // [START file_v1_generated_CloudFilestoreManager_CreateBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup's project and location, in the format + * `projects/{project_number}/locations/{location}`. In Cloud Filestore, + * backup locations map to GCP regions, for example **us-west1**. + */ + // const parent = 'abc123' + /** + * Required. A backup resource google.cloud.filestore.v1.Backup + */ + // const backup = {} + /** + * Required. The ID to use for the backup. + * The ID must be unique within the specified project and location. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + */ + // const backupId = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backup, + backupId, + }; + + // Run request + const [operation] = await filestoreClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END file_v1_generated_CloudFilestoreManager_CreateBackup_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/cloud_filestore_manager.create_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_instance.js new file mode 100644 index 0000000..f1ee31a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_instance.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(parent, instanceId, instance) { + // [START file_v1_generated_CloudFilestoreManager_CreateInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The instance's project and location, in the format + * `projects/{project_id}/locations/{location}`. In Cloud Filestore, + * locations map to GCP zones, for example **us-west1-b**. + */ + // const parent = 'abc123' + /** + * Required. The name of the instance to create. + * The name must be unique for the specified project and location. + */ + // const instanceId = 'abc123' + /** + * Required. An instance resource google.cloud.filestore.v1.Instance + */ + // const instance = {} + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callCreateInstance() { + // Construct request + const request = { + parent, + instanceId, + instance, + }; + + // Run request + const [operation] = await filestoreClient.createInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateInstance(); + // [END file_v1_generated_CloudFilestoreManager_CreateInstance_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/cloud_filestore_manager.delete_backup.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_backup.js new file mode 100644 index 0000000..e7a3f85 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_backup.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 file_v1_generated_CloudFilestoreManager_DeleteBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup resource name, in the format + * `projects/{project_number}/locations/{location}/backups/{backup_id}` + */ + // const name = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await filestoreClient.deleteBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackup(); + // [END file_v1_generated_CloudFilestoreManager_DeleteBackup_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/cloud_filestore_manager.delete_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_instance.js new file mode 100644 index 0000000..160d130 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_instance.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 file_v1_generated_CloudFilestoreManager_DeleteInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The instance resource name, in the format + * `projects/{project_id}/locations/{location}/instances/{instance_id}` + */ + // const name = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callDeleteInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await filestoreClient.deleteInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteInstance(); + // [END file_v1_generated_CloudFilestoreManager_DeleteInstance_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/cloud_filestore_manager.get_backup.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_backup.js new file mode 100644 index 0000000..dbf6552 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_backup.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 file_v1_generated_CloudFilestoreManager_GetBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup resource name, in the format + * `projects/{project_number}/locations/{location}/backups/{backup_id}`. + */ + // const name = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await filestoreClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END file_v1_generated_CloudFilestoreManager_GetBackup_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/cloud_filestore_manager.get_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_instance.js new file mode 100644 index 0000000..64c7a26 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_instance.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 file_v1_generated_CloudFilestoreManager_GetInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The instance resource name, in the format + * `projects/{project_id}/locations/{location}/instances/{instance_id}`. + */ + // const name = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callGetInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await filestoreClient.getInstance(request); + console.log(response); + } + + callGetInstance(); + // [END file_v1_generated_CloudFilestoreManager_GetInstance_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/cloud_filestore_manager.list_backups.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_backups.js new file mode 100644 index 0000000..37fe213 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_backups.js @@ -0,0 +1,82 @@ +// 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 file_v1_generated_CloudFilestoreManager_ListBackups_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location for which to retrieve backup + * information, in the format + * `projects/{project_number}/locations/{location}`. In Cloud Filestore, + * backup locations map to GCP regions, for example **us-west1**. To retrieve + * backup information for all locations, use "-" for the + * `{location}` value. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + */ + // const pageToken = 'abc123' + /** + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + */ + // const orderBy = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await filestoreClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END file_v1_generated_CloudFilestoreManager_ListBackups_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/cloud_filestore_manager.list_instances.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_instances.js new file mode 100644 index 0000000..800afa0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_instances.js @@ -0,0 +1,81 @@ +// 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 file_v1_generated_CloudFilestoreManager_ListInstances_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location for which to retrieve instance + * information, in the format `projects/{project_id}/locations/{location}`. In + * Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To + * retrieve instance information for all locations, use "-" for the + * `{location}` value. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + */ + // const pageToken = 'abc123' + /** + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + */ + // const orderBy = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callListInstances() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await filestoreClient.listInstancesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListInstances(); + // [END file_v1_generated_CloudFilestoreManager_ListInstances_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/cloud_filestore_manager.restore_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.restore_instance.js new file mode 100644 index 0000000..2be0689 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.restore_instance.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(name, fileShare) { + // [START file_v1_generated_CloudFilestoreManager_RestoreInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the instance, in the format + * `projects/{project_number}/locations/{location_id}/instances/{instance_id}`. + */ + // const name = 'abc123' + /** + * Required. Name of the file share in the Cloud Filestore instance that the + * backup is being restored to. + */ + // const fileShare = 'abc123' + /** + * The resource name of the backup, in the format + * `projects/{project_number}/locations/{location_id}/backups/{backup_id}`. + */ + // const sourceBackup = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callRestoreInstance() { + // Construct request + const request = { + name, + fileShare, + }; + + // Run request + const [operation] = await filestoreClient.restoreInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreInstance(); + // [END file_v1_generated_CloudFilestoreManager_RestoreInstance_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/cloud_filestore_manager.update_backup.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_backup.js new file mode 100644 index 0000000..153cf08 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_backup.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(backup, updateMask) { + // [START file_v1_generated_CloudFilestoreManager_UpdateBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A backup resource google.cloud.filestore.v1.Backup + */ + // const backup = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. + */ + // const updateMask = {} + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callUpdateBackup() { + // Construct request + const request = { + backup, + updateMask, + }; + + // Run request + const [operation] = await filestoreClient.updateBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateBackup(); + // [END file_v1_generated_CloudFilestoreManager_UpdateBackup_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/cloud_filestore_manager.update_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_instance.js new file mode 100644 index 0000000..80af363 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_instance.js @@ -0,0 +1,67 @@ +// 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() { + // [START file_v1_generated_CloudFilestoreManager_UpdateInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include these + * fields: + * * "description" + * * "file_shares" + * * "labels" + */ + // const updateMask = {} + /** + * Only fields specified in update_mask are updated. + */ + // const instance = {} + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callUpdateInstance() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await filestoreClient.updateInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateInstance(); + // [END file_v1_generated_CloudFilestoreManager_UpdateInstance_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.filestore.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.filestore.v1.json new file mode 100644 index 0000000..8ff56c3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.filestore.v1.json @@ -0,0 +1,519 @@ +{ + "clientLibrary": { + "name": "nodejs-filestore", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.filestore.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "file_v1_generated_CloudFilestoreManager_ListInstances_async", + "title": "CloudFilestoreManager listInstances Sample", + "origin": "API_DEFINITION", + "description": " Lists all instances in a project for either a specified location or for all locations.", + "canonical": true, + "file": "cloud_filestore_manager.list_instances.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListInstances", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.ListInstances", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.filestore.v1.ListInstancesResponse", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "ListInstances", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.ListInstances", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_GetInstance_async", + "title": "CloudFilestoreManager getInstance Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a specific instance.", + "canonical": true, + "file": "cloud_filestore_manager.get_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.GetInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.filestore.v1.Instance", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "GetInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.GetInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_CreateInstance_async", + "title": "CloudFilestoreManager createInstance Sample", + "origin": "API_DEFINITION", + "description": " Creates an instance. When creating from a backup, the capacity of the new instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).", + "canonical": true, + "file": "cloud_filestore_manager.create_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.CreateInstance", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "instance_id", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": ".google.cloud.filestore.v1.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "CreateInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.CreateInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_UpdateInstance_async", + "title": "CloudFilestoreManager updateInstance Sample", + "origin": "API_DEFINITION", + "description": " Updates the settings of a specific instance.", + "canonical": true, + "file": "cloud_filestore_manager.update_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.UpdateInstance", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "instance", + "type": ".google.cloud.filestore.v1.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "UpdateInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.UpdateInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_RestoreInstance_async", + "title": "CloudFilestoreManager restoreInstance Sample", + "origin": "API_DEFINITION", + "description": " Restores an existing instance's file share from a backup. The capacity of the instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).", + "canonical": true, + "file": "cloud_filestore_manager.restore_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.RestoreInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "file_share", + "type": "TYPE_STRING" + }, + { + "name": "source_backup", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "RestoreInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.RestoreInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_DeleteInstance_async", + "title": "CloudFilestoreManager deleteInstance Sample", + "origin": "API_DEFINITION", + "description": " Deletes an instance.", + "canonical": true, + "file": "cloud_filestore_manager.delete_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.DeleteInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.DeleteInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_ListBackups_async", + "title": "CloudFilestoreManager listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists all backups in a project for either a specified location or for all locations.", + "canonical": true, + "file": "cloud_filestore_manager.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.filestore.v1.ListBackupsResponse", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.ListBackups", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_GetBackup_async", + "title": "CloudFilestoreManager getBackup Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a specific backup.", + "canonical": true, + "file": "cloud_filestore_manager.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.filestore.v1.Backup", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.GetBackup", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_CreateBackup_async", + "title": "CloudFilestoreManager createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a backup.", + "canonical": true, + "file": "cloud_filestore_manager.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.filestore.v1.Backup" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.CreateBackup", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_DeleteBackup_async", + "title": "CloudFilestoreManager deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a backup.", + "canonical": true, + "file": "cloud_filestore_manager.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.DeleteBackup", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1_generated_CloudFilestoreManager_UpdateBackup_async", + "title": "CloudFilestoreManager updateBackup Sample", + "origin": "API_DEFINITION", + "description": " Updates the settings of a specific backup.", + "canonical": true, + "file": "cloud_filestore_manager.update_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.UpdateBackup", + "async": true, + "parameters": [ + { + "name": "backup", + "type": ".google.cloud.filestore.v1.Backup" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.UpdateBackup", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..1b1b749 --- /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 CloudFilestoreManagerClient = v1.CloudFilestoreManagerClient; +type CloudFilestoreManagerClient = v1.CloudFilestoreManagerClient; +export {v1, CloudFilestoreManagerClient}; +export default {v1, CloudFilestoreManagerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client.ts b/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client.ts new file mode 100644 index 0000000..f03eb31 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client.ts @@ -0,0 +1,1784 @@ +// 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/cloud_filestore_manager_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_filestore_manager_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Configures and manages Cloud Filestore resources. + * + * Cloud Filestore Manager v1. + * + * The `file.googleapis.com` service implements the Cloud Filestore API and + * defines the following resource model for managing instances: + * * The service works with a collection of cloud projects, named: `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * * Each location has a collection of instances and backups, named: + * `/instances/*` and `/backups/*` respectively. + * * As such, Cloud Filestore instances are resources of the form: + * `/projects/{project_number}/locations/{location_id}/instances/{instance_id}` + * and backups are resources of the form: + * `/projects/{project_number}/locations/{location_id}/backup/{backup_id}` + * + * Note that location_id must be a GCP `zone` for instances and but to a GCP + * `region` for backups; for example: + * * `projects/12345/locations/us-central1-c/instances/my-filestore` + * * `projects/12345/locations/us-central1/backups/my-backup` + * @class + * @memberof v1 + */ +export class CloudFilestoreManagerClient { + 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; + cloudFilestoreManagerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudFilestoreManagerClient. + * + * @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 CloudFilestoreManagerClient; + 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 = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backups/{backup}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + }; + + // 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 = { + listInstances: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + 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.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1.Instance') as gax.protobuf.Type; + const createInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const updateInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1.Instance') as gax.protobuf.Type; + const updateInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const restoreInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1.Instance') as gax.protobuf.Type; + const restoreInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const deleteInstanceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const deleteBackupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const updateBackupResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1.Backup') as gax.protobuf.Type; + const updateBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createInstanceResponse.decode.bind(createInstanceResponse), + createInstanceMetadata.decode.bind(createInstanceMetadata)), + updateInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateInstanceResponse.decode.bind(updateInstanceResponse), + updateInstanceMetadata.decode.bind(updateInstanceMetadata)), + restoreInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreInstanceResponse.decode.bind(restoreInstanceResponse), + restoreInstanceMetadata.decode.bind(restoreInstanceMetadata)), + deleteInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteInstanceResponse.decode.bind(deleteInstanceResponse), + deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + deleteBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupResponse.decode.bind(deleteBackupResponse), + deleteBackupMetadata.decode.bind(deleteBackupMetadata)), + updateBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateBackupResponse.decode.bind(updateBackupResponse), + updateBackupMetadata.decode.bind(updateBackupMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.filestore.v1.CloudFilestoreManager', 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.cloudFilestoreManagerStub) { + return this.cloudFilestoreManagerStub; + } + + // Put together the "service stub" for + // google.cloud.filestore.v1.CloudFilestoreManager. + this.cloudFilestoreManagerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.filestore.v1.CloudFilestoreManager') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.filestore.v1.CloudFilestoreManager, + 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 cloudFilestoreManagerStubMethods = + ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'restoreInstance', 'deleteInstance', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'updateBackup']; + for (const methodName of cloudFilestoreManagerStubMethods) { + const callPromise = this.cloudFilestoreManagerStub.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.cloudFilestoreManagerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'file.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 'file.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 -- + // ------------------- +/** + * Gets the details of a specific instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The instance resource name, in the format + * `projects/{project_id}/locations/{location}/instances/{instance_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Instance]{@link google.cloud.filestore.v1.Instance}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/cloud_filestore_manager.get_instance.js + * region_tag:file_v1_generated_CloudFilestoreManager_GetInstance_async + */ + getInstance( + request?: protos.google.cloud.filestore.v1.IGetInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.filestore.v1.IInstance, + protos.google.cloud.filestore.v1.IGetInstanceRequest|undefined, {}|undefined + ]>; + getInstance( + request: protos.google.cloud.filestore.v1.IGetInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.filestore.v1.IInstance, + protos.google.cloud.filestore.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request: protos.google.cloud.filestore.v1.IGetInstanceRequest, + callback: Callback< + protos.google.cloud.filestore.v1.IInstance, + protos.google.cloud.filestore.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request?: protos.google.cloud.filestore.v1.IGetInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.filestore.v1.IInstance, + protos.google.cloud.filestore.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.filestore.v1.IInstance, + protos.google.cloud.filestore.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.filestore.v1.IInstance, + protos.google.cloud.filestore.v1.IGetInstanceRequest|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.getInstance(request, options, callback); + } +/** + * Gets the details of a specific backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The backup resource name, in the format + * `projects/{project_number}/locations/{location}/backups/{backup_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Backup]{@link google.cloud.filestore.v1.Backup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/cloud_filestore_manager.get_backup.js + * region_tag:file_v1_generated_CloudFilestoreManager_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.filestore.v1.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.filestore.v1.IBackup, + protos.google.cloud.filestore.v1.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.cloud.filestore.v1.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.filestore.v1.IBackup, + protos.google.cloud.filestore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.cloud.filestore.v1.IGetBackupRequest, + callback: Callback< + protos.google.cloud.filestore.v1.IBackup, + protos.google.cloud.filestore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.cloud.filestore.v1.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.filestore.v1.IBackup, + protos.google.cloud.filestore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.filestore.v1.IBackup, + protos.google.cloud.filestore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.filestore.v1.IBackup, + protos.google.cloud.filestore.v1.IGetBackupRequest|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.getBackup(request, options, callback); + } + +/** + * Creates an instance. + * When creating from a backup, the capacity of the new instance needs to be + * equal to or larger than the capacity of the backup (and also equal to or + * larger than the minimum capacity of the tier). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The instance's project and location, in the format + * `projects/{project_id}/locations/{location}`. In Cloud Filestore, + * locations map to GCP zones, for example **us-west1-b**. + * @param {string} request.instanceId + * Required. The name of the instance to create. + * The name must be unique for the specified project and location. + * @param {google.cloud.filestore.v1.Instance} request.instance + * Required. An {@link google.cloud.filestore.v1.Instance|instance 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/cloud_filestore_manager.create_instance.js + * region_tag:file_v1_generated_CloudFilestoreManager_CreateInstance_async + */ + createInstance( + request?: protos.google.cloud.filestore.v1.ICreateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createInstance( + request: protos.google.cloud.filestore.v1.ICreateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request: protos.google.cloud.filestore.v1.ICreateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request?: protos.google.cloud.filestore.v1.ICreateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + 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.createInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_filestore_manager.create_instance.js + * region_tag:file_v1_generated_CloudFilestoreManager_CreateInstance_async + */ + async checkCreateInstanceProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the settings of a specific instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask of fields to update. At least one path must be supplied in this + * field. The elements of the repeated paths field may only include these + * fields: + * + * * "description" + * * "file_shares" + * * "labels" + * @param {google.cloud.filestore.v1.Instance} request.instance + * Only 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/cloud_filestore_manager.update_instance.js + * region_tag:file_v1_generated_CloudFilestoreManager_UpdateInstance_async + */ + updateInstance( + request?: protos.google.cloud.filestore.v1.IUpdateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateInstance( + request: protos.google.cloud.filestore.v1.IUpdateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateInstance( + request: protos.google.cloud.filestore.v1.IUpdateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateInstance( + request?: protos.google.cloud.filestore.v1.IUpdateInstanceRequest, + 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({ + 'instance.name': request.instance!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateInstance()`. + * @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/cloud_filestore_manager.update_instance.js + * region_tag:file_v1_generated_CloudFilestoreManager_UpdateInstance_async + */ + async checkUpdateInstanceProgress(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.updateInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restores an existing instance's file share from a backup. + * + * The capacity of the instance needs to be equal to or larger than the + * capacity of the backup (and also equal to or larger than the minimum + * capacity of the tier). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the instance, in the format + * `projects/{project_number}/locations/{location_id}/instances/{instance_id}`. + * @param {string} request.fileShare + * Required. Name of the file share in the Cloud Filestore instance that the + * backup is being restored to. + * @param {string} request.sourceBackup + * The resource name of the backup, in the format + * `projects/{project_number}/locations/{location_id}/backups/{backup_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * 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/cloud_filestore_manager.restore_instance.js + * region_tag:file_v1_generated_CloudFilestoreManager_RestoreInstance_async + */ + restoreInstance( + request?: protos.google.cloud.filestore.v1.IRestoreInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreInstance( + request: protos.google.cloud.filestore.v1.IRestoreInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreInstance( + request: protos.google.cloud.filestore.v1.IRestoreInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreInstance( + request?: protos.google.cloud.filestore.v1.IRestoreInstanceRequest, + 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.restoreInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreInstance()`. + * @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/cloud_filestore_manager.restore_instance.js + * region_tag:file_v1_generated_CloudFilestoreManager_RestoreInstance_async + */ + async checkRestoreInstanceProgress(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.restoreInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The instance resource name, in the format + * `projects/{project_id}/locations/{location}/instances/{instance_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * 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/cloud_filestore_manager.delete_instance.js + * region_tag:file_v1_generated_CloudFilestoreManager_DeleteInstance_async + */ + deleteInstance( + request?: protos.google.cloud.filestore.v1.IDeleteInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteInstance( + request: protos.google.cloud.filestore.v1.IDeleteInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request: protos.google.cloud.filestore.v1.IDeleteInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request?: protos.google.cloud.filestore.v1.IDeleteInstanceRequest, + 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.deleteInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteInstance()`. + * @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/cloud_filestore_manager.delete_instance.js + * region_tag:file_v1_generated_CloudFilestoreManager_DeleteInstance_async + */ + async checkDeleteInstanceProgress(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.deleteInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The backup's project and location, in the format + * `projects/{project_number}/locations/{location}`. In Cloud Filestore, + * backup locations map to GCP regions, for example **us-west1**. + * @param {google.cloud.filestore.v1.Backup} request.backup + * Required. A {@link google.cloud.filestore.v1.Backup|backup resource} + * @param {string} request.backupId + * Required. The ID to use for the backup. + * The ID must be unique within the specified project and location. + * + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * Values that do not match this pattern will trigger an INVALID_ARGUMENT + * error. + * @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/cloud_filestore_manager.create_backup.js + * region_tag:file_v1_generated_CloudFilestoreManager_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.filestore.v1.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.cloud.filestore.v1.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.cloud.filestore.v1.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.cloud.filestore.v1.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + 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.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_filestore_manager.create_backup.js + * region_tag:file_v1_generated_CloudFilestoreManager_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBackup, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The backup resource name, in the format + * `projects/{project_number}/locations/{location}/backups/{backup_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * 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/cloud_filestore_manager.delete_backup.js + * region_tag:file_v1_generated_CloudFilestoreManager_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.filestore.v1.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.cloud.filestore.v1.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.cloud.filestore.v1.IDeleteBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.cloud.filestore.v1.IDeleteBackupRequest, + 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.deleteBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackup()`. + * @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/cloud_filestore_manager.delete_backup.js + * region_tag:file_v1_generated_CloudFilestoreManager_DeleteBackup_async + */ + async checkDeleteBackupProgress(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.deleteBackup, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the settings of a specific backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.filestore.v1.Backup} request.backup + * Required. A {@link google.cloud.filestore.v1.Backup|backup resource} + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in + * this field. + * @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/cloud_filestore_manager.update_backup.js + * region_tag:file_v1_generated_CloudFilestoreManager_UpdateBackup_async + */ + updateBackup( + request?: protos.google.cloud.filestore.v1.IUpdateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateBackup( + request: protos.google.cloud.filestore.v1.IUpdateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBackup( + request: protos.google.cloud.filestore.v1.IUpdateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBackup( + request?: protos.google.cloud.filestore.v1.IUpdateBackupRequest, + 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({ + 'backup.name': request.backup!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateBackup()`. + * @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/cloud_filestore_manager.update_backup.js + * region_tag:file_v1_generated_CloudFilestoreManager_UpdateBackup_async + */ + async checkUpdateBackupProgress(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.updateBackup, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all instances in a project for either a specified location + * or for all locations. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve instance + * information, in the format `projects/{project_id}/locations/{location}`. In + * Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To + * retrieve instance information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Instance]{@link google.cloud.filestore.v1.Instance}. + * 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 `listInstancesAsync()` + * 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. + */ + listInstances( + request?: protos.google.cloud.filestore.v1.IListInstancesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.filestore.v1.IInstance[], + protos.google.cloud.filestore.v1.IListInstancesRequest|null, + protos.google.cloud.filestore.v1.IListInstancesResponse + ]>; + listInstances( + request: protos.google.cloud.filestore.v1.IListInstancesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.filestore.v1.IListInstancesRequest, + protos.google.cloud.filestore.v1.IListInstancesResponse|null|undefined, + protos.google.cloud.filestore.v1.IInstance>): void; + listInstances( + request: protos.google.cloud.filestore.v1.IListInstancesRequest, + callback: PaginationCallback< + protos.google.cloud.filestore.v1.IListInstancesRequest, + protos.google.cloud.filestore.v1.IListInstancesResponse|null|undefined, + protos.google.cloud.filestore.v1.IInstance>): void; + listInstances( + request?: protos.google.cloud.filestore.v1.IListInstancesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.filestore.v1.IListInstancesRequest, + protos.google.cloud.filestore.v1.IListInstancesResponse|null|undefined, + protos.google.cloud.filestore.v1.IInstance>, + callback?: PaginationCallback< + protos.google.cloud.filestore.v1.IListInstancesRequest, + protos.google.cloud.filestore.v1.IListInstancesResponse|null|undefined, + protos.google.cloud.filestore.v1.IInstance>): + Promise<[ + protos.google.cloud.filestore.v1.IInstance[], + protos.google.cloud.filestore.v1.IListInstancesRequest|null, + protos.google.cloud.filestore.v1.IListInstancesResponse + ]>|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.listInstances(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 project and location for which to retrieve instance + * information, in the format `projects/{project_id}/locations/{location}`. In + * Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To + * retrieve instance information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Instance]{@link google.cloud.filestore.v1.Instance} 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 `listInstancesAsync()` + * 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. + */ + listInstancesStream( + request?: protos.google.cloud.filestore.v1.IListInstancesRequest, + 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['listInstances']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInstances.createStream( + this.innerApiCalls.listInstances as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listInstances`, 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 project and location for which to retrieve instance + * information, in the format `projects/{project_id}/locations/{location}`. In + * Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To + * retrieve instance information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Instance]{@link google.cloud.filestore.v1.Instance}. 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/cloud_filestore_manager.list_instances.js + * region_tag:file_v1_generated_CloudFilestoreManager_ListInstances_async + */ + listInstancesAsync( + request?: protos.google.cloud.filestore.v1.IListInstancesRequest, + 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['listInstances']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInstances.asyncIterate( + this.innerApiCalls['listInstances'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all backups in a project for either a specified location or for all + * locations. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve backup + * information, in the format + * `projects/{project_number}/locations/{location}`. In Cloud Filestore, + * backup locations map to GCP regions, for example **us-west1**. To retrieve + * backup information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Backup]{@link google.cloud.filestore.v1.Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.filestore.v1.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.filestore.v1.IBackup[], + protos.google.cloud.filestore.v1.IListBackupsRequest|null, + protos.google.cloud.filestore.v1.IListBackupsResponse + ]>; + listBackups( + request: protos.google.cloud.filestore.v1.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.filestore.v1.IListBackupsRequest, + protos.google.cloud.filestore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.filestore.v1.IBackup>): void; + listBackups( + request: protos.google.cloud.filestore.v1.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.filestore.v1.IListBackupsRequest, + protos.google.cloud.filestore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.filestore.v1.IBackup>): void; + listBackups( + request?: protos.google.cloud.filestore.v1.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.filestore.v1.IListBackupsRequest, + protos.google.cloud.filestore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.filestore.v1.IBackup>, + callback?: PaginationCallback< + protos.google.cloud.filestore.v1.IListBackupsRequest, + protos.google.cloud.filestore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.filestore.v1.IBackup>): + Promise<[ + protos.google.cloud.filestore.v1.IBackup[], + protos.google.cloud.filestore.v1.IListBackupsRequest|null, + protos.google.cloud.filestore.v1.IListBackupsResponse + ]>|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.listBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve backup + * information, in the format + * `projects/{project_number}/locations/{location}`. In Cloud Filestore, + * backup locations map to GCP regions, for example **us-west1**. To retrieve + * backup information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Backup]{@link google.cloud.filestore.v1.Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.filestore.v1.IListBackupsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve backup + * information, in the format + * `projects/{project_number}/locations/{location}`. In Cloud Filestore, + * backup locations map to GCP regions, for example **us-west1**. To retrieve + * backup information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Backup]{@link google.cloud.filestore.v1.Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/cloud_filestore_manager.list_backups.js + * region_tag:file_v1_generated_CloudFilestoreManager_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.filestore.v1.IListBackupsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,location:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + location: location, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the location from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).location; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: 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; + } + + /** + * 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.cloudFilestoreManagerStub && !this._terminated) { + return this.cloudFilestoreManagerStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client_config.json b/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client_config.json new file mode 100644 index 0000000..fc1ccfd --- /dev/null +++ b/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client_config.json @@ -0,0 +1,93 @@ +{ + "interfaces": { + "google.cloud.filestore.v1.CloudFilestoreManager": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "9442ca297df43f7314712e1a19d003838e738a45": { + "initial_retry_delay_millis": 250, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 32000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListInstances": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "GetInstance": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "CreateInstance": { + "timeout_millis": 60000000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateInstance": { + "timeout_millis": 14400000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreInstance": { + "timeout_millis": 60000000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteInstance": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "CreateBackup": { + "timeout_millis": 60000000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBackup": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/cloud_filestore_manager_proto_list.json b/owl-bot-staging/v1/src/v1/cloud_filestore_manager_proto_list.json new file mode 100644 index 0000000..b5434ce --- /dev/null +++ b/owl-bot-staging/v1/src/v1/cloud_filestore_manager_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/common/operation_metadata.proto", + "../../protos/google/cloud/filestore/v1/cloud_filestore_service.proto" +] 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..92789f7 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,141 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.filestore.v1", + "libraryPackage": "@google-cloud/filestore", + "services": { + "CloudFilestoreManager": { + "clients": { + "grpc": { + "libraryClient": "CloudFilestoreManagerClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "RestoreInstance": { + "methods": [ + "restoreInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "ListInstances": { + "methods": [ + "listInstances", + "listInstancesStream", + "listInstancesAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudFilestoreManagerClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "RestoreInstance": { + "methods": [ + "restoreInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "ListInstances": { + "methods": [ + "listInstances", + "listInstancesStream", + "listInstancesAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + } + } +} 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..1ea2142 --- /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 {CloudFilestoreManagerClient} from './cloud_filestore_manager_client'; 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..987a396 --- /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 filestore = require('@google-cloud/filestore'); + +function main() { + const cloudFilestoreManagerClient = new filestore.CloudFilestoreManagerClient(); +} + +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..d9a17a4 --- /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 {CloudFilestoreManagerClient} from '@google-cloud/filestore'; + +// check that the client class type name can be used +function doStuffWithCloudFilestoreManagerClient(client: CloudFilestoreManagerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const cloudFilestoreManagerClient = new CloudFilestoreManagerClient(); + doStuffWithCloudFilestoreManagerClient(cloudFilestoreManagerClient); +} + +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_cloud_filestore_manager_v1.ts b/owl-bot-staging/v1/test/gapic_cloud_filestore_manager_v1.ts new file mode 100644 index 0000000..694e8c4 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_cloud_filestore_manager_v1.ts @@ -0,0 +1,1987 @@ +// 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 cloudfilestoremanagerModule 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.CloudFilestoreManagerClient', () => { + it('has servicePath', () => { + const servicePath = cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFilestoreManagerStub, undefined); + await client.initialize(); + assert(client.cloudFilestoreManagerStub); + }); + + it('has close method for the initialized client', done => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudFilestoreManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFilestoreManagerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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 cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getInstance', () => { + it('invokes getInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()); + client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); + const [response] = await client.getInstance(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()); + client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstance( + request, + (err?: Error|null, result?: protos.google.cloud.filestore.v1.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getInstance with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInstance(request), expectedError); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getInstance with closed client', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetInstanceRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInstance(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.cloud.filestore.v1.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getBackup with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetBackupRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('createInstance', () => { + it('invokes createInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.createInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createInstance with call error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createInstance(request), expectedError); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createInstance with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateInstanceProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateInstanceProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateInstance', () => { + it('invokes updateInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInstance( + 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.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateInstance with call error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateInstance(request), expectedError); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateInstance with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateInstanceProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkUpdateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateInstanceProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkUpdateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreInstance', () => { + it('invokes restoreInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.RestoreInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.RestoreInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreInstance( + 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.restoreInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes restoreInstance with call error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.RestoreInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreInstance(request), expectedError); + assert((client.innerApiCalls.restoreInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreInstance with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.RestoreInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.restoreInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRestoreInstanceProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkRestoreInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreInstanceProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkRestoreInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteInstance', () => { + it('invokes deleteInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInstance( + 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.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteInstance with call error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteInstance(request), expectedError); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteInstance with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteInstanceProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkDeleteInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteInstanceProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkDeleteInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createBackup with call error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + 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.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteBackup with call error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBackup with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackup(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteBackupProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkDeleteBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkDeleteBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateBackup', () => { + it('invokes updateBackup without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBackup without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackup( + 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.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateBackup with call error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateBackup(request), expectedError); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBackup with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateBackup(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateBackupProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkUpdateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateBackupProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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.checkUpdateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listInstances', () => { + it('invokes listInstances without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + ]; + client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); + const [response] = await client.listInstances(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listInstances without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + ]; + client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInstances( + request, + (err?: Error|null, result?: protos.google.cloud.filestore.v1.IInstance[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listInstances with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listInstances(request), expectedError); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listInstancesStream without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + ]; + client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.filestore.v1.Instance[] = []; + stream.on('data', (response: protos.google.cloud.filestore.v1.Instance) => { + 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.listInstances.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); + assert.strictEqual( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listInstancesStream with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.filestore.v1.Instance[] = []; + stream.on('data', (response: protos.google.cloud.filestore.v1.Instance) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); + assert.strictEqual( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listInstances without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), + ]; + client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.filestore.v1.IInstance[] = []; + const iterable = client.listInstancesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listInstances with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInstancesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.filestore.v1.IInstance[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.cloud.filestore.v1.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listBackups with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.filestore.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.filestore.v1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert.strictEqual( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.filestore.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.filestore.v1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert.strictEqual( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.filestore.v1.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.filestore.v1.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backup: "backupValue", + }; + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + }; + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "locationValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ + 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)); + }); + }); + }); +}); 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..5566a34 --- /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: 'CloudFilestoreManager', + filename: './cloud-filestore-manager.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..52876d4 --- /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/filestore', + 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..048fe77 --- /dev/null +++ b/owl-bot-staging/v1beta1/README.md @@ -0,0 +1 @@ +Filestore: 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..ff98186 --- /dev/null +++ b/owl-bot-staging/v1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/filestore", + "version": "0.1.0", + "description": "Filestore client for Node.js", + "repository": "googleapis/nodejs-filestore", + "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 filestore", + "filestore", + "cloud filestore manager" + ], + "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/common/operation_metadata.proto b/owl-bot-staging/v1beta1/protos/google/cloud/common/operation_metadata.proto new file mode 100644 index 0000000..24300e3 --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/common/operation_metadata.proto @@ -0,0 +1,53 @@ +// 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.common; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/common;common"; +option java_multiple_files = true; +option java_package = "com.google.cloud.common"; + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // 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. Human-readable status of the operation, if any. + string status_detail = 5 [(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][] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto b/owl-bot-staging/v1beta1/protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto new file mode 100644 index 0000000..eff8471 --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto @@ -0,0 +1,766 @@ +// 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.filestore.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Filestore.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/filestore/v1beta1;filestore"; +option java_multiple_files = true; +option java_outer_classname = "CloudFilestoreServiceProto"; +option java_package = "com.google.cloud.filestore.v1beta1"; +option php_namespace = "Google\\Cloud\\Filestore\\V1beta1"; + +// Configures and manages Cloud Filestore resources. +// +// Cloud Filestore Manager v1beta1. +// +// The `file.googleapis.com` service implements the Cloud Filestore API and +// defines the following model for managing resources: +// * The service works with a collection of cloud projects, named: `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// * Each location has a collection of instances and backups, named: +// `/instances/*` and `/backups/*` respectively. +// * As such, Cloud Filestore instances are resources of the form: +// `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` +// backups are resources of the form: +// `/projects/{project_id}/locations/{location_id}/backup/{backup_id}` +// +// Note that location_id can represent a GCP `zone` or `region` depending on the +// resource. +// for example: +// A zonal Filestore instance: +// * `projects/my-project/locations/us-central1-c/instances/my-basic-tier-filer` +// A regional Filestore instance: +// * `projects/my-project/locations/us-central1/instances/my-enterprise-filer` +service CloudFilestoreManager { + option (google.api.default_host) = "file.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all instances in a project for either a specified location + // or for all locations. + rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/instances" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a specific instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an instance. + // When creating from a backup, the capacity of the new instance needs to be + // equal to or larger than the capacity of the backup (and also equal to or + // larger than the minimum capacity of the tier). + rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/instances" + body: "instance" + }; + option (google.api.method_signature) = "parent,instance,instance_id"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Updates the settings of a specific instance. + rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{instance.name=projects/*/locations/*/instances/*}" + body: "instance" + }; + option (google.api.method_signature) = "instance,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Restores an existing instance's file share from a backup. + // + // The capacity of the instance needs to be equal to or larger than the + // capacity of the backup (and also equal to or larger than the minimum + // capacity of the tier). + rpc RestoreInstance(RestoreInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/instances/*}:restore" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Deletes an instance. + rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Lists all backups in a project for either a specified location or for all + // locations. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a specific backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a backup. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup,backup_id"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Deletes a backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } + + // Updates the settings of a specific backup. + rpc UpdateBackup(UpdateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta1/{backup.name=projects/*/locations/*/backups/*}" + body: "backup" + }; + option (google.api.method_signature) = "backup,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.common.OperationMetadata" + }; + } +} + +// Network configuration for the instance. +message NetworkConfig { + // Internet protocol versions supported by Cloud Filestore. + enum AddressMode { + // Internet protocol not set. + ADDRESS_MODE_UNSPECIFIED = 0; + + // Use the IPv4 internet protocol. + MODE_IPV4 = 1; + } + + // The name of the Google Compute Engine + // [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the + // instance is connected. + string network = 1; + + // Internet protocol versions for which the instance has IP addresses + // assigned. For this version, only MODE_IPV4 is supported. + repeated AddressMode modes = 3; + + // A /29 CIDR block for Basic or a /23 CIDR block for High Scale in one of the + // [internal IP address + // ranges](https://www.arin.net/reference/research/statistics/address_filters/) + // that identifies the range of IP addresses reserved for this instance. For + // example, 10.0.0.0/29 or 192.168.0.0/23. The range you specify can't overlap + // with either existing subnets or assigned IP address ranges for other Cloud + // Filestore instances in the selected VPC network. + string reserved_ip_range = 4; + + // Output only. IPv4 addresses in the format + // `{octet1}.{octet2}.{octet3}.{octet4}` or IPv6 addresses in the format + // `{block1}:{block2}:{block3}:{block4}:{block5}:{block6}:{block7}:{block8}`. + repeated string ip_addresses = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// File share configuration for the instance. +message FileShareConfig { + // The name of the file share (must be 16 characters or less). + string name = 1; + + // File share capacity in gigabytes (GB). + // Cloud Filestore defines 1 GB as 1024^3 bytes. + int64 capacity_gb = 2; + + // The source that this file share has been restored from. Empty if the file + // share is created from scratch. + oneof source { + // The resource name of the backup, in the format + // `projects/{project_id}/locations/{location_id}/backups/{backup_id}`, that + // this file share has been restored from. + string source_backup = 9 [(google.api.resource_reference) = { + type: "file.googleapis.com/Backup" + }]; + } + + // Nfs Export Options. + // There is a limit of 10 export options per file share. + repeated NfsExportOptions nfs_export_options = 8; +} + +// NFS export options specifications. +message NfsExportOptions { + // The access mode. + enum AccessMode { + // AccessMode not set. + ACCESS_MODE_UNSPECIFIED = 0; + + // The client can only read the file share. + READ_ONLY = 1; + + // The client can read and write the file share (default). + READ_WRITE = 2; + } + + // The squash mode. + enum SquashMode { + // SquashMode not set. + SQUASH_MODE_UNSPECIFIED = 0; + + // The Root user has root access to the file share (default). + NO_ROOT_SQUASH = 1; + + // The Root user has squashed access to the anonymous uid/gid. + ROOT_SQUASH = 2; + } + + // List of either an IPv4 addresses in the format + // `{octet1}.{octet2}.{octet3}.{octet4}` or CIDR ranges in the format + // `{octet1}.{octet2}.{octet3}.{octet4}/{mask size}` which may mount the + // file share. + // Overlapping IP ranges are not allowed, both within and across + // NfsExportOptions. An error will be returned. + // The limit is 64 IP ranges/addresses for each FileShareConfig among all + // NfsExportOptions. + repeated string ip_ranges = 1; + + // Either READ_ONLY, for allowing only read requests on the exported + // directory, or READ_WRITE, for allowing both read and write requests. + // The default is READ_WRITE. + AccessMode access_mode = 2; + + // Either NO_ROOT_SQUASH, for allowing root access on the exported directory, + // or ROOT_SQUASH, for not allowing root access. The default is + // NO_ROOT_SQUASH. + SquashMode squash_mode = 3; + + // An integer representing the anonymous user id with a default value of + // 65534. + // Anon_uid may only be set with squash_mode of ROOT_SQUASH. An error will be + // returned if this field is specified for other squash_mode settings. + int64 anon_uid = 4; + + // An integer representing the anonymous group id with a default value of + // 65534. + // Anon_gid may only be set with squash_mode of ROOT_SQUASH. An error will be + // returned if this field is specified for other squash_mode settings. + int64 anon_gid = 5; +} + +// A Cloud Filestore instance. +message Instance { + option (google.api.resource) = { + type: "file.googleapis.com/Instance" + pattern: "projects/{project}/locations/{location}/instances/{instance}" + }; + + // The instance state. + enum State { + // State not set. + STATE_UNSPECIFIED = 0; + + // The instance is being created. + CREATING = 1; + + // The instance is available for use. + READY = 2; + + // Work is being done on the instance. You can get further details from the + // `statusMessage` field of the `Instance` resource. + REPAIRING = 3; + + // The instance is shutting down. + DELETING = 4; + + // The instance is experiencing an issue and might be unusable. You can get + // further details from the `statusMessage` field of the `Instance` + // resource. + ERROR = 6; + + // The instance is restoring a snapshot or backup to an existing file share + // and may be unusable during this time. + RESTORING = 7; + } + + // Available service tiers. + enum Tier { + // Not set. + TIER_UNSPECIFIED = 0; + + // STANDARD tier. BASIC_HDD is the preferred term for this tier. + STANDARD = 1; + + // PREMIUM tier. BASIC_SSD is the preferred term for this tier. + PREMIUM = 2; + + // BASIC instances offer a maximum capacity of 63.9 TB. + // BASIC_HDD is an alias for STANDARD Tier, offering economical + // performance backed by HDD. + BASIC_HDD = 3; + + // BASIC instances offer a maximum capacity of 63.9 TB. + // BASIC_SSD is an alias for PREMIUM Tier, and offers improved + // performance backed by SSD. + BASIC_SSD = 4; + + // HIGH_SCALE instances offer expanded capacity and performance scaling + // capabilities. + HIGH_SCALE_SSD = 6; + } + + // Output only. The resource name of the instance, in the format + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of the instance (2048 characters or less). + string description = 2; + + // Output only. The instance state. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the instance state, if available. + string status_message = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the instance was created. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The service tier of the instance. + Tier tier = 8; + + // Resource labels to represent user provided metadata. + map labels = 9; + + // File system shares on the instance. + // For this version, only a single file share is supported. + repeated FileShareConfig file_shares = 10; + + // VPC networks to which the instance is connected. + // For this version, only a single network is supported. + repeated NetworkConfig networks = 11; + + // Server-specified ETag for the instance resource to prevent simultaneous + // updates from overwriting each other. + string etag = 12; + + // Output only. Reserved for future use. + google.protobuf.BoolValue satisfies_pzs = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// CreateInstanceRequest creates an instance. +message CreateInstanceRequest { + // Required. The instance's project and location, in the format + // `projects/{project_id}/locations/{location}`. In Cloud Filestore, + // locations map to GCP zones, for example **us-west1-b**. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The ID of the instance to create. + // The ID must be unique within the specified project and location. + // + // This value must start with a lowercase letter followed by up to 62 + // lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. An [instance resource][google.cloud.filestore.v1beta1.Instance] + Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// GetInstanceRequest gets the state of an instance. +message GetInstanceRequest { + // Required. The instance resource name, in the format + // `projects/{project_id}/locations/{location}/instances/{instance_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "file.googleapis.com/Instance" + } + ]; +} + +// UpdateInstanceRequest updates the settings of an instance. +message UpdateInstanceRequest { + // Required. Mask of fields to update. At least one path must be supplied in this + // field. The elements of the repeated paths field may only include these + // fields: + // + // * "description" + // * "file_shares" + // * "labels" + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Only fields specified in update_mask are updated. + Instance instance = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// RestoreInstanceRequest restores an existing instances's file share from a +// snapshot or backup. +message RestoreInstanceRequest { + // Required. The resource name of the instance, in the format + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "file.googleapis.com/Instance" + } + ]; + + // Required. Name of the file share in the Cloud Filestore instance that the snapshot + // is being restored to. + string file_share = 2 [(google.api.field_behavior) = REQUIRED]; + + oneof source { + // The resource name of the snapshot, in the format + // `projects/{project_id}/locations/{location_id}/snapshots/{snapshot_id}`. + string source_snapshot = 3 [(google.api.resource_reference) = { + type: "file.googleapis.com/Snapshot" + }]; + + // The resource name of the backup, in the format + // `projects/{project_id}/locations/{location_id}/backups/{backup_id}`. + string source_backup = 4 [(google.api.resource_reference) = { + type: "file.googleapis.com/Backup" + }]; + } +} + +// DeleteInstanceRequest deletes an instance. +message DeleteInstanceRequest { + // Required. The instance resource name, in the format + // `projects/{project_id}/locations/{location}/instances/{instance_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "file.googleapis.com/Instance" + } + ]; +} + +// ListInstancesRequest lists instances. +message ListInstancesRequest { + // Required. The project and location for which to retrieve instance information, + // in the format `projects/{project_id}/locations/{location}`. In Cloud + // Filestore, locations map to GCP zones, for example **us-west1-b**. To + // retrieve instance information for all locations, use "-" for the + // `{location}` value. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value to use if there are additional + // results to retrieve for this list request. + string page_token = 3; + + // Sort results. Supported values are "name", "name desc" or "" (unsorted). + string order_by = 4; + + // List filter. + string filter = 5; +} + +// ListInstancesResponse is the result of ListInstancesRequest. +message ListInstancesResponse { + // A list of instances in the project for the specified location. + // + // If the `{location}` value in the request is "-", the response contains a + // list of instances from all locations. If any location is unreachable, the + // response will only return instances in reachable locations and the + // "unreachable" field will be populated with a list of unreachable locations. + repeated Instance instances = 1; + + // The token you can use to retrieve the next page of results. Not returned + // if there are no more results in the list. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A Cloud Filestore snapshot. +message Snapshot { + option (google.api.resource) = { + type: "file.googleapis.com/Snapshot" + pattern: "projects/{project}/locations/{location}/instances/{instance}/snapshots/{snapshot}" + }; + + // The snapshot state. + enum State { + // State not set. + STATE_UNSPECIFIED = 0; + + // Snapshot is being created. + CREATING = 1; + + // Snapshot is available for use. + READY = 3; + + // Snapshot is being deleted. + DELETING = 4; + } + + // Output only. The resource name of the snapshot, in the format + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A description of the snapshot with 2048 characters or less. + // Requests with longer descriptions will be rejected. + string description = 2; + + // Output only. The snapshot state. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the snapshot was created. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Resource labels to represent user provided metadata. + map labels = 5; + + // Output only. The amount of bytes needed to allocate a full copy of the snapshot content + int64 filesystem_used_bytes = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A Cloud Filestore backup. +message Backup { + option (google.api.resource) = { + type: "file.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/backups/{backup}" + }; + + // The backup state. + enum State { + // State not set. + STATE_UNSPECIFIED = 0; + + // Backup is being created. + CREATING = 1; + + // Backup has been taken and the operation is being finalized. At this + // point, changes to the file share will not be reflected in the backup. + FINALIZING = 2; + + // Backup is available for use. + READY = 3; + + // Backup is being deleted. + DELETING = 4; + } + + // Output only. The resource name of the backup, in the format + // `projects/{project_id}/locations/{location_id}/backups/{backup_id}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A description of the backup with 2048 characters or less. + // Requests with longer descriptions will be rejected. + string description = 2; + + // Output only. The backup state. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the backup was created. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Resource labels to represent user provided metadata. + map labels = 5; + + // Output only. Capacity of the source file share when the backup was created. + int64 capacity_gb = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The size of the storage used by the backup. As backups share storage, + // this number is expected to change with backup creation/deletion. + int64 storage_bytes = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The resource name of the source Cloud Filestore instance, in the format + // `projects/{project_id}/locations/{location_id}/instances/{instance_id}`, + // used to create this backup. + string source_instance = 8 [(google.api.resource_reference) = { + type: "file.googleapis.com/Instance" + }]; + + // Name of the file share in the source Cloud Filestore instance that the + // backup is created from. + string source_file_share = 9; + + // Output only. The service tier of the source Cloud Filestore instance that this backup + // is created from. + Instance.Tier source_instance_tier = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Amount of bytes that will be downloaded if the backup is restored + int64 download_bytes = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Reserved for future use. + google.protobuf.BoolValue satisfies_pzs = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// CreateBackupRequest creates a backup. +message CreateBackupRequest { + // Required. The backup's project and location, in the format + // `projects/{project_id}/locations/{location}`. In Cloud Filestore, + // backup locations map to GCP regions, for example **us-west1**. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. A [backup resource][google.cloud.filestore.v1beta1.Backup] + Backup backup = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the backup. + // The ID must be unique within the specified project and location. + // + // This value must start with a lowercase letter followed by up to 62 + // lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + string backup_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// DeleteBackupRequest deletes a backup. +message DeleteBackupRequest { + // Required. The backup resource name, in the format + // `projects/{project_id}/locations/{location}/backups/{backup_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "file.googleapis.com/Backup" + } + ]; +} + +// UpdateBackupRequest updates description and/or labels for a backup. +message UpdateBackupRequest { + // Required. A [backup resource][google.cloud.filestore.v1beta1.Backup] + Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Mask of fields to update. At least one path must be supplied in this + // field. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// GetBackupRequest gets the state of a backup. +message GetBackupRequest { + // Required. The backup resource name, in the format + // `projects/{project_id}/locations/{location}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "file.googleapis.com/Backup" + } + ]; +} + +// ListBackupsRequest lists backups. +message ListBackupsRequest { + // Required. The project and location for which to retrieve backup information, + // in the format `projects/{project_id}/locations/{location}`. + // In Cloud Filestore, backup locations map to GCP regions, + // for example **us-west1**. + // To retrieve backup information for all locations, use "-" for the + // `{location}` value. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value to use if there are additional + // results to retrieve for this list request. + string page_token = 3; + + // Sort results. Supported values are "name", "name desc" or "" (unsorted). + string order_by = 4; + + // List filter. + string filter = 5; +} + +// ListBackupsResponse is the result of ListBackupsRequest. +message ListBackupsResponse { + // A list of backups in the project for the specified location. + // + // If the `{location}` value in the request is "-", the response contains a + // list of backups from all locations. If any location is unreachable, the + // response will only return backups in reachable locations and the + // "unreachable" field will be populated with a list of unreachable + // locations. + repeated Backup backups = 1; + + // The token you can use to retrieve the next page of results. Not returned + // if there are no more results in the list. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_backup.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_backup.js new file mode 100644 index 0000000..8a1d810 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_backup.js @@ -0,0 +1,74 @@ +// 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, backup, backupId) { + // [START file_v1beta1_generated_CloudFilestoreManager_CreateBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup's project and location, in the format + * `projects/{project_id}/locations/{location}`. In Cloud Filestore, + * backup locations map to GCP regions, for example **us-west1**. + */ + // const parent = 'abc123' + /** + * Required. A backup resource google.cloud.filestore.v1beta1.Backup + */ + // const backup = {} + /** + * Required. The ID to use for the backup. + * The ID must be unique within the specified project and location. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + */ + // const backupId = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backup, + backupId, + }; + + // Run request + const [operation] = await filestoreClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END file_v1beta1_generated_CloudFilestoreManager_CreateBackup_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/cloud_filestore_manager.create_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_instance.js new file mode 100644 index 0000000..efd8d80 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_instance.js @@ -0,0 +1,74 @@ +// 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, instanceId, instance) { + // [START file_v1beta1_generated_CloudFilestoreManager_CreateInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The instance's project and location, in the format + * `projects/{project_id}/locations/{location}`. In Cloud Filestore, + * locations map to GCP zones, for example **us-west1-b**. + */ + // const parent = 'abc123' + /** + * Required. The ID of the instance to create. + * The ID must be unique within the specified project and location. + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + */ + // const instanceId = 'abc123' + /** + * Required. An instance resource google.cloud.filestore.v1beta1.Instance + */ + // const instance = {} + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callCreateInstance() { + // Construct request + const request = { + parent, + instanceId, + instance, + }; + + // Run request + const [operation] = await filestoreClient.createInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateInstance(); + // [END file_v1beta1_generated_CloudFilestoreManager_CreateInstance_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/cloud_filestore_manager.delete_backup.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_backup.js new file mode 100644 index 0000000..29babc4 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_backup.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 file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup resource name, in the format + * `projects/{project_id}/locations/{location}/backups/{backup_id}` + */ + // const name = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await filestoreClient.deleteBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackup(); + // [END file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_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/cloud_filestore_manager.delete_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_instance.js new file mode 100644 index 0000000..115388b --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_instance.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 file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The instance resource name, in the format + * `projects/{project_id}/locations/{location}/instances/{instance_id}` + */ + // const name = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callDeleteInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await filestoreClient.deleteInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteInstance(); + // [END file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_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/cloud_filestore_manager.get_backup.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_backup.js new file mode 100644 index 0000000..6a1ba8d --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_backup.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 file_v1beta1_generated_CloudFilestoreManager_GetBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup resource name, in the format + * `projects/{project_id}/locations/{location}/backups/{backup_id}`. + */ + // const name = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await filestoreClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END file_v1beta1_generated_CloudFilestoreManager_GetBackup_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/cloud_filestore_manager.get_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_instance.js new file mode 100644 index 0000000..5b1b616 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_instance.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 file_v1beta1_generated_CloudFilestoreManager_GetInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The instance resource name, in the format + * `projects/{project_id}/locations/{location}/instances/{instance_id}`. + */ + // const name = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callGetInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await filestoreClient.getInstance(request); + console.log(response); + } + + callGetInstance(); + // [END file_v1beta1_generated_CloudFilestoreManager_GetInstance_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/cloud_filestore_manager.list_backups.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_backups.js new file mode 100644 index 0000000..20b4215 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_backups.js @@ -0,0 +1,82 @@ +// 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 file_v1beta1_generated_CloudFilestoreManager_ListBackups_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location for which to retrieve backup information, + * in the format `projects/{project_id}/locations/{location}`. + * In Cloud Filestore, backup locations map to GCP regions, + * for example **us-west1**. + * To retrieve backup information for all locations, use "-" for the + * `{location}` value. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + */ + // const pageToken = 'abc123' + /** + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + */ + // const orderBy = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await filestoreClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END file_v1beta1_generated_CloudFilestoreManager_ListBackups_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/cloud_filestore_manager.list_instances.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_instances.js new file mode 100644 index 0000000..550c331 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_instances.js @@ -0,0 +1,81 @@ +// 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 file_v1beta1_generated_CloudFilestoreManager_ListInstances_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location for which to retrieve instance information, + * in the format `projects/{project_id}/locations/{location}`. In Cloud + * Filestore, locations map to GCP zones, for example **us-west1-b**. To + * retrieve instance information for all locations, use "-" for the + * `{location}` value. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + */ + // const pageToken = 'abc123' + /** + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + */ + // const orderBy = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callListInstances() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await filestoreClient.listInstancesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListInstances(); + // [END file_v1beta1_generated_CloudFilestoreManager_ListInstances_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/cloud_filestore_manager.restore_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.restore_instance.js new file mode 100644 index 0000000..feac018 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.restore_instance.js @@ -0,0 +1,76 @@ +// 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, fileShare) { + // [START file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the instance, in the format + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`. + */ + // const name = 'abc123' + /** + * Required. Name of the file share in the Cloud Filestore instance that the snapshot + * is being restored to. + */ + // const fileShare = 'abc123' + /** + * The resource name of the snapshot, in the format + * `projects/{project_id}/locations/{location_id}/snapshots/{snapshot_id}`. + */ + // const sourceSnapshot = 'abc123' + /** + * The resource name of the backup, in the format + * `projects/{project_id}/locations/{location_id}/backups/{backup_id}`. + */ + // const sourceBackup = 'abc123' + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callRestoreInstance() { + // Construct request + const request = { + name, + fileShare, + }; + + // Run request + const [operation] = await filestoreClient.restoreInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreInstance(); + // [END file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_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/cloud_filestore_manager.update_backup.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_backup.js new file mode 100644 index 0000000..d1c471a --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_backup.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(backup, updateMask) { + // [START file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A backup resource google.cloud.filestore.v1beta1.Backup + */ + // const backup = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in this + * field. + */ + // const updateMask = {} + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callUpdateBackup() { + // Construct request + const request = { + backup, + updateMask, + }; + + // Run request + const [operation] = await filestoreClient.updateBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateBackup(); + // [END file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_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/cloud_filestore_manager.update_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_instance.js new file mode 100644 index 0000000..176ad3d --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_instance.js @@ -0,0 +1,69 @@ +// 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, instance) { + // [START file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_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 these + * fields: + * * "description" + * * "file_shares" + * * "labels" + */ + // const updateMask = {} + /** + * Required. Only fields specified in update_mask are updated. + */ + // const instance = {} + + // Imports the Filestore library + const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; + + // Instantiates a client + const filestoreClient = new CloudFilestoreManagerClient(); + + async function callUpdateInstance() { + // Construct request + const request = { + updateMask, + instance, + }; + + // Run request + const [operation] = await filestoreClient.updateInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateInstance(); + // [END file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_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.filestore.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.filestore.v1beta1.json new file mode 100644 index 0000000..319df89 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.filestore.v1beta1.json @@ -0,0 +1,523 @@ +{ + "clientLibrary": { + "name": "nodejs-filestore", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.filestore.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_ListInstances_async", + "title": "CloudFilestoreManager listInstances Sample", + "origin": "API_DEFINITION", + "description": " Lists all instances in a project for either a specified location or for all locations.", + "canonical": true, + "file": "cloud_filestore_manager.list_instances.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListInstances", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.ListInstances", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.filestore.v1beta1.ListInstancesResponse", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "ListInstances", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.ListInstances", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_GetInstance_async", + "title": "CloudFilestoreManager getInstance Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a specific instance.", + "canonical": true, + "file": "cloud_filestore_manager.get_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.GetInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.filestore.v1beta1.Instance", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "GetInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.GetInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_CreateInstance_async", + "title": "CloudFilestoreManager createInstance Sample", + "origin": "API_DEFINITION", + "description": " Creates an instance. When creating from a backup, the capacity of the new instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).", + "canonical": true, + "file": "cloud_filestore_manager.create_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.CreateInstance", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "instance_id", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": ".google.cloud.filestore.v1beta1.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "CreateInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.CreateInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_async", + "title": "CloudFilestoreManager updateInstance Sample", + "origin": "API_DEFINITION", + "description": " Updates the settings of a specific instance.", + "canonical": true, + "file": "cloud_filestore_manager.update_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.UpdateInstance", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "instance", + "type": ".google.cloud.filestore.v1beta1.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "UpdateInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.UpdateInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_async", + "title": "CloudFilestoreManager restoreInstance Sample", + "origin": "API_DEFINITION", + "description": " Restores an existing instance's file share from a backup. The capacity of the instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).", + "canonical": true, + "file": "cloud_filestore_manager.restore_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.RestoreInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "file_share", + "type": "TYPE_STRING" + }, + { + "name": "source_snapshot", + "type": "TYPE_STRING" + }, + { + "name": "source_backup", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "RestoreInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.RestoreInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_async", + "title": "CloudFilestoreManager deleteInstance Sample", + "origin": "API_DEFINITION", + "description": " Deletes an instance.", + "canonical": true, + "file": "cloud_filestore_manager.delete_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.DeleteInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.DeleteInstance", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_ListBackups_async", + "title": "CloudFilestoreManager listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists all backups in a project for either a specified location or for all locations.", + "canonical": true, + "file": "cloud_filestore_manager.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.filestore.v1beta1.ListBackupsResponse", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.ListBackups", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_GetBackup_async", + "title": "CloudFilestoreManager getBackup Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a specific backup.", + "canonical": true, + "file": "cloud_filestore_manager.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.filestore.v1beta1.Backup", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.GetBackup", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_CreateBackup_async", + "title": "CloudFilestoreManager createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a backup.", + "canonical": true, + "file": "cloud_filestore_manager.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.filestore.v1beta1.Backup" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.CreateBackup", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_async", + "title": "CloudFilestoreManager deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a backup.", + "canonical": true, + "file": "cloud_filestore_manager.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.DeleteBackup", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + }, + { + "regionTag": "file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_async", + "title": "CloudFilestoreManager updateBackup Sample", + "origin": "API_DEFINITION", + "description": " Updates the settings of a specific backup.", + "canonical": true, + "file": "cloud_filestore_manager.update_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.UpdateBackup", + "async": true, + "parameters": [ + { + "name": "backup", + "type": ".google.cloud.filestore.v1beta1.Backup" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFilestoreManagerClient", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" + }, + "method": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.UpdateBackup", + "service": { + "shortName": "CloudFilestoreManager", + "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts new file mode 100644 index 0000000..53ba300 --- /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 CloudFilestoreManagerClient = v1beta1.CloudFilestoreManagerClient; +type CloudFilestoreManagerClient = v1beta1.CloudFilestoreManagerClient; +export {v1beta1, CloudFilestoreManagerClient}; +export default {v1beta1, CloudFilestoreManagerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client.ts new file mode 100644 index 0000000..04764e2 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client.ts @@ -0,0 +1,1856 @@ +// 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/cloud_filestore_manager_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_filestore_manager_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Configures and manages Cloud Filestore resources. + * + * Cloud Filestore Manager v1beta1. + * + * The `file.googleapis.com` service implements the Cloud Filestore API and + * defines the following model for managing resources: + * * The service works with a collection of cloud projects, named: `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * * Each location has a collection of instances and backups, named: + * `/instances/*` and `/backups/*` respectively. + * * As such, Cloud Filestore instances are resources of the form: + * `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` + * backups are resources of the form: + * `/projects/{project_id}/locations/{location_id}/backup/{backup_id}` + * + * Note that location_id can represent a GCP `zone` or `region` depending on the + * resource. + * for example: + * A zonal Filestore instance: + * * `projects/my-project/locations/us-central1-c/instances/my-basic-tier-filer` + * A regional Filestore instance: + * * `projects/my-project/locations/us-central1/instances/my-enterprise-filer` + * @class + * @memberof v1beta1 + */ +export class CloudFilestoreManagerClient { + 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; + cloudFilestoreManagerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudFilestoreManagerClient. + * + * @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 CloudFilestoreManagerClient; + 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 = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backups/{backup}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + snapshotPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}/snapshots/{snapshot}' + ), + }; + + // 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 = { + listInstances: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + 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.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1beta1.Instance') as gax.protobuf.Type; + const createInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const updateInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1beta1.Instance') as gax.protobuf.Type; + const updateInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const restoreInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1beta1.Instance') as gax.protobuf.Type; + const restoreInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const deleteInstanceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1beta1.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const deleteBackupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + const updateBackupResponse = protoFilesRoot.lookup( + '.google.cloud.filestore.v1beta1.Backup') as gax.protobuf.Type; + const updateBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createInstanceResponse.decode.bind(createInstanceResponse), + createInstanceMetadata.decode.bind(createInstanceMetadata)), + updateInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateInstanceResponse.decode.bind(updateInstanceResponse), + updateInstanceMetadata.decode.bind(updateInstanceMetadata)), + restoreInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreInstanceResponse.decode.bind(restoreInstanceResponse), + restoreInstanceMetadata.decode.bind(restoreInstanceMetadata)), + deleteInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteInstanceResponse.decode.bind(deleteInstanceResponse), + deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + deleteBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupResponse.decode.bind(deleteBackupResponse), + deleteBackupMetadata.decode.bind(deleteBackupMetadata)), + updateBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateBackupResponse.decode.bind(updateBackupResponse), + updateBackupMetadata.decode.bind(updateBackupMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.filestore.v1beta1.CloudFilestoreManager', 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.cloudFilestoreManagerStub) { + return this.cloudFilestoreManagerStub; + } + + // Put together the "service stub" for + // google.cloud.filestore.v1beta1.CloudFilestoreManager. + this.cloudFilestoreManagerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.filestore.v1beta1.CloudFilestoreManager') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.filestore.v1beta1.CloudFilestoreManager, + 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 cloudFilestoreManagerStubMethods = + ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'restoreInstance', 'deleteInstance', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'updateBackup']; + for (const methodName of cloudFilestoreManagerStubMethods) { + const callPromise = this.cloudFilestoreManagerStub.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.cloudFilestoreManagerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'file.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 'file.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 -- + // ------------------- +/** + * Gets the details of a specific instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The instance resource name, in the format + * `projects/{project_id}/locations/{location}/instances/{instance_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Instance]{@link google.cloud.filestore.v1beta1.Instance}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/cloud_filestore_manager.get_instance.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_GetInstance_async + */ + getInstance( + request?: protos.google.cloud.filestore.v1beta1.IGetInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.filestore.v1beta1.IInstance, + protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|undefined, {}|undefined + ]>; + getInstance( + request: protos.google.cloud.filestore.v1beta1.IGetInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.filestore.v1beta1.IInstance, + protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request: protos.google.cloud.filestore.v1beta1.IGetInstanceRequest, + callback: Callback< + protos.google.cloud.filestore.v1beta1.IInstance, + protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request?: protos.google.cloud.filestore.v1beta1.IGetInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.filestore.v1beta1.IInstance, + protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.filestore.v1beta1.IInstance, + protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.filestore.v1beta1.IInstance, + protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|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.getInstance(request, options, callback); + } +/** + * Gets the details of a specific backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The backup resource name, in the format + * `projects/{project_id}/locations/{location}/backups/{backup_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Backup]{@link google.cloud.filestore.v1beta1.Backup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/cloud_filestore_manager.get_backup.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.filestore.v1beta1.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.filestore.v1beta1.IBackup, + protos.google.cloud.filestore.v1beta1.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.cloud.filestore.v1beta1.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.filestore.v1beta1.IBackup, + protos.google.cloud.filestore.v1beta1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.cloud.filestore.v1beta1.IGetBackupRequest, + callback: Callback< + protos.google.cloud.filestore.v1beta1.IBackup, + protos.google.cloud.filestore.v1beta1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.cloud.filestore.v1beta1.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.filestore.v1beta1.IBackup, + protos.google.cloud.filestore.v1beta1.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.filestore.v1beta1.IBackup, + protos.google.cloud.filestore.v1beta1.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.filestore.v1beta1.IBackup, + protos.google.cloud.filestore.v1beta1.IGetBackupRequest|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.getBackup(request, options, callback); + } + +/** + * Creates an instance. + * When creating from a backup, the capacity of the new instance needs to be + * equal to or larger than the capacity of the backup (and also equal to or + * larger than the minimum capacity of the tier). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The instance's project and location, in the format + * `projects/{project_id}/locations/{location}`. In Cloud Filestore, + * locations map to GCP zones, for example **us-west1-b**. + * @param {string} request.instanceId + * Required. The ID of the instance to create. + * The ID must be unique within the specified project and location. + * + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * @param {google.cloud.filestore.v1beta1.Instance} request.instance + * Required. An {@link google.cloud.filestore.v1beta1.Instance|instance 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/cloud_filestore_manager.create_instance.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_CreateInstance_async + */ + createInstance( + request?: protos.google.cloud.filestore.v1beta1.ICreateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createInstance( + request: protos.google.cloud.filestore.v1beta1.ICreateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request: protos.google.cloud.filestore.v1beta1.ICreateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request?: protos.google.cloud.filestore.v1beta1.ICreateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + 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.createInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/cloud_filestore_manager.create_instance.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_CreateInstance_async + */ + async checkCreateInstanceProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the settings of a specific instance. + * + * @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 these + * fields: + * + * * "description" + * * "file_shares" + * * "labels" + * @param {google.cloud.filestore.v1beta1.Instance} request.instance + * Required. Only 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/cloud_filestore_manager.update_instance.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_async + */ + updateInstance( + request?: protos.google.cloud.filestore.v1beta1.IUpdateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateInstance( + request: protos.google.cloud.filestore.v1beta1.IUpdateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateInstance( + request: protos.google.cloud.filestore.v1beta1.IUpdateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateInstance( + request?: protos.google.cloud.filestore.v1beta1.IUpdateInstanceRequest, + 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({ + 'instance.name': request.instance!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateInstance()`. + * @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/cloud_filestore_manager.update_instance.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_async + */ + async checkUpdateInstanceProgress(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.updateInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restores an existing instance's file share from a backup. + * + * The capacity of the instance needs to be equal to or larger than the + * capacity of the backup (and also equal to or larger than the minimum + * capacity of the tier). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the instance, in the format + * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`. + * @param {string} request.fileShare + * Required. Name of the file share in the Cloud Filestore instance that the snapshot + * is being restored to. + * @param {string} request.sourceSnapshot + * The resource name of the snapshot, in the format + * `projects/{project_id}/locations/{location_id}/snapshots/{snapshot_id}`. + * @param {string} request.sourceBackup + * The resource name of the backup, in the format + * `projects/{project_id}/locations/{location_id}/backups/{backup_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * 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/cloud_filestore_manager.restore_instance.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_async + */ + restoreInstance( + request?: protos.google.cloud.filestore.v1beta1.IRestoreInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreInstance( + request: protos.google.cloud.filestore.v1beta1.IRestoreInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreInstance( + request: protos.google.cloud.filestore.v1beta1.IRestoreInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreInstance( + request?: protos.google.cloud.filestore.v1beta1.IRestoreInstanceRequest, + 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.restoreInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreInstance()`. + * @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/cloud_filestore_manager.restore_instance.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_async + */ + async checkRestoreInstanceProgress(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.restoreInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The instance resource name, in the format + * `projects/{project_id}/locations/{location}/instances/{instance_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * 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/cloud_filestore_manager.delete_instance.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_async + */ + deleteInstance( + request?: protos.google.cloud.filestore.v1beta1.IDeleteInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteInstance( + request: protos.google.cloud.filestore.v1beta1.IDeleteInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request: protos.google.cloud.filestore.v1beta1.IDeleteInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request?: protos.google.cloud.filestore.v1beta1.IDeleteInstanceRequest, + 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.deleteInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteInstance()`. + * @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/cloud_filestore_manager.delete_instance.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_async + */ + async checkDeleteInstanceProgress(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.deleteInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The backup's project and location, in the format + * `projects/{project_id}/locations/{location}`. In Cloud Filestore, + * backup locations map to GCP regions, for example **us-west1**. + * @param {google.cloud.filestore.v1beta1.Backup} request.backup + * Required. A {@link google.cloud.filestore.v1beta1.Backup|backup resource} + * @param {string} request.backupId + * Required. The ID to use for the backup. + * The ID must be unique within the specified project and location. + * + * This value must start with a lowercase letter followed by up to 62 + * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. + * @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/cloud_filestore_manager.create_backup.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.filestore.v1beta1.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.cloud.filestore.v1beta1.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.cloud.filestore.v1beta1.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.cloud.filestore.v1beta1.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + 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.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/cloud_filestore_manager.create_backup.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBackup, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The backup resource name, in the format + * `projects/{project_id}/locations/{location}/backups/{backup_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * 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/cloud_filestore_manager.delete_backup.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.filestore.v1beta1.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.cloud.filestore.v1beta1.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.cloud.filestore.v1beta1.IDeleteBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.cloud.filestore.v1beta1.IDeleteBackupRequest, + 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.deleteBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackup()`. + * @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/cloud_filestore_manager.delete_backup.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_async + */ + async checkDeleteBackupProgress(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.deleteBackup, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the settings of a specific backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.filestore.v1beta1.Backup} request.backup + * Required. A {@link google.cloud.filestore.v1beta1.Backup|backup resource} + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields to update. At least one path must be supplied in this + * field. + * @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/cloud_filestore_manager.update_backup.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_async + */ + updateBackup( + request?: protos.google.cloud.filestore.v1beta1.IUpdateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateBackup( + request: protos.google.cloud.filestore.v1beta1.IUpdateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBackup( + request: protos.google.cloud.filestore.v1beta1.IUpdateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateBackup( + request?: protos.google.cloud.filestore.v1beta1.IUpdateBackupRequest, + 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({ + 'backup.name': request.backup!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateBackup()`. + * @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/cloud_filestore_manager.update_backup.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_async + */ + async checkUpdateBackupProgress(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.updateBackup, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all instances in a project for either a specified location + * or for all locations. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve instance information, + * in the format `projects/{project_id}/locations/{location}`. In Cloud + * Filestore, locations map to GCP zones, for example **us-west1-b**. To + * retrieve instance information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Instance]{@link google.cloud.filestore.v1beta1.Instance}. + * 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 `listInstancesAsync()` + * 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. + */ + listInstances( + request?: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.filestore.v1beta1.IInstance[], + protos.google.cloud.filestore.v1beta1.IListInstancesRequest|null, + protos.google.cloud.filestore.v1beta1.IListInstancesResponse + ]>; + listInstances( + request: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + protos.google.cloud.filestore.v1beta1.IListInstancesResponse|null|undefined, + protos.google.cloud.filestore.v1beta1.IInstance>): void; + listInstances( + request: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + callback: PaginationCallback< + protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + protos.google.cloud.filestore.v1beta1.IListInstancesResponse|null|undefined, + protos.google.cloud.filestore.v1beta1.IInstance>): void; + listInstances( + request?: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + protos.google.cloud.filestore.v1beta1.IListInstancesResponse|null|undefined, + protos.google.cloud.filestore.v1beta1.IInstance>, + callback?: PaginationCallback< + protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + protos.google.cloud.filestore.v1beta1.IListInstancesResponse|null|undefined, + protos.google.cloud.filestore.v1beta1.IInstance>): + Promise<[ + protos.google.cloud.filestore.v1beta1.IInstance[], + protos.google.cloud.filestore.v1beta1.IListInstancesRequest|null, + protos.google.cloud.filestore.v1beta1.IListInstancesResponse + ]>|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.listInstances(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 project and location for which to retrieve instance information, + * in the format `projects/{project_id}/locations/{location}`. In Cloud + * Filestore, locations map to GCP zones, for example **us-west1-b**. To + * retrieve instance information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Instance]{@link google.cloud.filestore.v1beta1.Instance} 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 `listInstancesAsync()` + * 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. + */ + listInstancesStream( + request?: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + 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['listInstances']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInstances.createStream( + this.innerApiCalls.listInstances as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listInstances`, 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 project and location for which to retrieve instance information, + * in the format `projects/{project_id}/locations/{location}`. In Cloud + * Filestore, locations map to GCP zones, for example **us-west1-b**. To + * retrieve instance information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Instance]{@link google.cloud.filestore.v1beta1.Instance}. 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/cloud_filestore_manager.list_instances.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_ListInstances_async + */ + listInstancesAsync( + request?: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, + 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['listInstances']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listInstances.asyncIterate( + this.innerApiCalls['listInstances'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all backups in a project for either a specified location or for all + * locations. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve backup information, + * in the format `projects/{project_id}/locations/{location}`. + * In Cloud Filestore, backup locations map to GCP regions, + * for example **us-west1**. + * To retrieve backup information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Backup]{@link google.cloud.filestore.v1beta1.Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.filestore.v1beta1.IBackup[], + protos.google.cloud.filestore.v1beta1.IListBackupsRequest|null, + protos.google.cloud.filestore.v1beta1.IListBackupsResponse + ]>; + listBackups( + request: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + protos.google.cloud.filestore.v1beta1.IListBackupsResponse|null|undefined, + protos.google.cloud.filestore.v1beta1.IBackup>): void; + listBackups( + request: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + protos.google.cloud.filestore.v1beta1.IListBackupsResponse|null|undefined, + protos.google.cloud.filestore.v1beta1.IBackup>): void; + listBackups( + request?: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + protos.google.cloud.filestore.v1beta1.IListBackupsResponse|null|undefined, + protos.google.cloud.filestore.v1beta1.IBackup>, + callback?: PaginationCallback< + protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + protos.google.cloud.filestore.v1beta1.IListBackupsResponse|null|undefined, + protos.google.cloud.filestore.v1beta1.IBackup>): + Promise<[ + protos.google.cloud.filestore.v1beta1.IBackup[], + protos.google.cloud.filestore.v1beta1.IListBackupsRequest|null, + protos.google.cloud.filestore.v1beta1.IListBackupsResponse + ]>|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.listBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve backup information, + * in the format `projects/{project_id}/locations/{location}`. + * In Cloud Filestore, backup locations map to GCP regions, + * for example **us-west1**. + * To retrieve backup information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Backup]{@link google.cloud.filestore.v1beta1.Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve backup information, + * in the format `projects/{project_id}/locations/{location}`. + * In Cloud Filestore, backup locations map to GCP regions, + * for example **us-west1**. + * To retrieve backup information for all locations, use "-" for the + * `{location}` value. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value to use if there are additional + * results to retrieve for this list request. + * @param {string} request.orderBy + * Sort results. Supported values are "name", "name desc" or "" (unsorted). + * @param {string} request.filter + * List filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Backup]{@link google.cloud.filestore.v1beta1.Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta1/cloud_filestore_manager.list_backups.js + * region_tag:file_v1beta1_generated_CloudFilestoreManager_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,location:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + location: location, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the location from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).location; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: 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 snapshot resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @param {string} snapshot + * @returns {string} Resource name string. + */ + snapshotPath(project:string,location:string,instance:string,snapshot:string) { + return this.pathTemplates.snapshotPathTemplate.render({ + project: project, + location: location, + instance: instance, + snapshot: snapshot, + }); + } + + /** + * Parse the project from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project; + } + + /** + * Parse the location from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).location; + } + + /** + * Parse the instance from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).instance; + } + + /** + * Parse the snapshot from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the snapshot. + */ + matchSnapshotFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot; + } + + /** + * 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.cloudFilestoreManagerStub && !this._terminated) { + return this.cloudFilestoreManagerStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client_config.json new file mode 100644 index 0000000..628a32b --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client_config.json @@ -0,0 +1,93 @@ +{ + "interfaces": { + "google.cloud.filestore.v1beta1.CloudFilestoreManager": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "9442ca297df43f7314712e1a19d003838e738a45": { + "initial_retry_delay_millis": 250, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 32000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListInstances": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "GetInstance": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "CreateInstance": { + "timeout_millis": 60000000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateInstance": { + "timeout_millis": 14400000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreInstance": { + "timeout_millis": 60000000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteInstance": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" + }, + "CreateBackup": { + "timeout_millis": 60000000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBackup": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_proto_list.json new file mode 100644 index 0000000..848c8cd --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/common/operation_metadata.proto", + "../../protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto" +] 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..efd3287 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,141 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.filestore.v1beta1", + "libraryPackage": "@google-cloud/filestore", + "services": { + "CloudFilestoreManager": { + "clients": { + "grpc": { + "libraryClient": "CloudFilestoreManagerClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "RestoreInstance": { + "methods": [ + "restoreInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "ListInstances": { + "methods": [ + "listInstances", + "listInstancesStream", + "listInstancesAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudFilestoreManagerClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "RestoreInstance": { + "methods": [ + "restoreInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "ListInstances": { + "methods": [ + "listInstances", + "listInstancesStream", + "listInstancesAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + } + } +} 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..1ea2142 --- /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 {CloudFilestoreManagerClient} from './cloud_filestore_manager_client'; 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..987a396 --- /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 filestore = require('@google-cloud/filestore'); + +function main() { + const cloudFilestoreManagerClient = new filestore.CloudFilestoreManagerClient(); +} + +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..d9a17a4 --- /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 {CloudFilestoreManagerClient} from '@google-cloud/filestore'; + +// check that the client class type name can be used +function doStuffWithCloudFilestoreManagerClient(client: CloudFilestoreManagerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const cloudFilestoreManagerClient = new CloudFilestoreManagerClient(); + doStuffWithCloudFilestoreManagerClient(cloudFilestoreManagerClient); +} + +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_cloud_filestore_manager_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_cloud_filestore_manager_v1beta1.ts new file mode 100644 index 0000000..46871fe --- /dev/null +++ b/owl-bot-staging/v1beta1/test/gapic_cloud_filestore_manager_v1beta1.ts @@ -0,0 +1,2041 @@ +// 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 cloudfilestoremanagerModule 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.CloudFilestoreManagerClient', () => { + it('has servicePath', () => { + const servicePath = cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFilestoreManagerStub, undefined); + await client.initialize(); + assert(client.cloudFilestoreManagerStub); + }); + + it('has close method for the initialized client', done => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudFilestoreManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFilestoreManagerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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 cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getInstance', () => { + it('invokes getInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()); + client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); + const [response] = await client.getInstance(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()); + client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstance( + request, + (err?: Error|null, result?: protos.google.cloud.filestore.v1beta1.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getInstance with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInstance(request), expectedError); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getInstance with closed client', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetInstanceRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInstance(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.cloud.filestore.v1beta1.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getBackup with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetBackupRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('createInstance', () => { + it('invokes createInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.createInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createInstance with call error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createInstance(request), expectedError); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createInstance with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateInstanceProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateInstanceProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateInstance', () => { + it('invokes updateInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInstance( + 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.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateInstance with call error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateInstance(request), expectedError); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateInstance with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateInstanceProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkUpdateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateInstanceProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkUpdateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreInstance', () => { + it('invokes restoreInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.RestoreInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.RestoreInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreInstance( + 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.restoreInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes restoreInstance with call error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.RestoreInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreInstance(request), expectedError); + assert((client.innerApiCalls.restoreInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreInstance with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.RestoreInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.restoreInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRestoreInstanceProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkRestoreInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreInstanceProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkRestoreInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteInstance', () => { + it('invokes deleteInstance without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteInstance without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInstance( + 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.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteInstance with call error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteInstance(request), expectedError); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteInstance with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteInstanceProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkDeleteInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteInstanceProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkDeleteInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createBackup with call error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + 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.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteBackup with call error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBackup with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackup(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteBackupProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkDeleteBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkDeleteBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateBackup', () => { + it('invokes updateBackup without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBackup without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackup( + 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.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateBackup with call error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateBackup(request), expectedError); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBackup with LRO error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateBackup(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateBackupProgress without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkUpdateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateBackupProgress with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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.checkUpdateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listInstances', () => { + it('invokes listInstances without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + ]; + client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); + const [response] = await client.listInstances(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listInstances without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + ]; + client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInstances( + request, + (err?: Error|null, result?: protos.google.cloud.filestore.v1beta1.IInstance[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listInstances with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listInstances(request), expectedError); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listInstancesStream without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + ]; + client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.filestore.v1beta1.Instance[] = []; + stream.on('data', (response: protos.google.cloud.filestore.v1beta1.Instance) => { + 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.listInstances.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); + assert.strictEqual( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listInstancesStream with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.filestore.v1beta1.Instance[] = []; + stream.on('data', (response: protos.google.cloud.filestore.v1beta1.Instance) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); + assert.strictEqual( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listInstances without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), + ]; + client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.filestore.v1beta1.IInstance[] = []; + const iterable = client.listInstancesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listInstances with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInstancesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.filestore.v1beta1.IInstance[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.cloud.filestore.v1beta1.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listBackups with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.filestore.v1beta1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.filestore.v1beta1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert.strictEqual( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.filestore.v1beta1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.filestore.v1beta1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert.strictEqual( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.filestore.v1beta1.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.filestore.v1beta1.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backup: "backupValue", + }; + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + }; + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "locationValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + 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('snapshot', () => { + const fakePath = "/rendered/path/snapshot"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + snapshot: "snapshotValue", + }; + const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.snapshotPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.snapshotPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('snapshotPath', () => { + const result = client.snapshotPath("projectValue", "locationValue", "instanceValue", "snapshotValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.snapshotPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSnapshotName', () => { + const result = client.matchProjectFromSnapshotName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromSnapshotName', () => { + const result = client.matchLocationFromSnapshotName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromSnapshotName', () => { + const result = client.matchInstanceFromSnapshotName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSnapshotFromSnapshotName', () => { + const result = client.matchSnapshotFromSnapshotName(fakePath); + assert.strictEqual(result, "snapshotValue"); + assert((client.pathTemplates.snapshotPathTemplate.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..5566a34 --- /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: 'CloudFilestoreManager', + filename: './cloud-filestore-manager.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 d5b6a926e35848dc81ed2a3963e4eba0c3211333 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:34:00 +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 - .../cloud/common/operation_metadata.proto | 53 - .../v1/cloud_filestore_service.proto | 718 ------ .../cloud_filestore_manager.create_backup.js | 76 - ...cloud_filestore_manager.create_instance.js | 72 - .../cloud_filestore_manager.delete_backup.js | 60 - ...cloud_filestore_manager.delete_instance.js | 60 - .../v1/cloud_filestore_manager.get_backup.js | 59 - .../cloud_filestore_manager.get_instance.js | 59 - .../cloud_filestore_manager.list_backups.js | 82 - .../cloud_filestore_manager.list_instances.js | 81 - ...loud_filestore_manager.restore_instance.js | 71 - .../cloud_filestore_manager.update_backup.js | 65 - ...cloud_filestore_manager.update_instance.js | 67 - ...et_metadata.google.cloud.filestore.v1.json | 519 ----- owl-bot-staging/v1/src/index.ts | 25 - .../src/v1/cloud_filestore_manager_client.ts | 1784 -------------- ...cloud_filestore_manager_client_config.json | 93 - .../cloud_filestore_manager_proto_list.json | 4 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 141 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../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 - .../test/gapic_cloud_filestore_manager_v1.ts | 1987 ---------------- 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 - .../cloud/common/operation_metadata.proto | 53 - .../v1beta1/cloud_filestore_service.proto | 766 ------- .../cloud_filestore_manager.create_backup.js | 74 - ...cloud_filestore_manager.create_instance.js | 74 - .../cloud_filestore_manager.delete_backup.js | 60 - ...cloud_filestore_manager.delete_instance.js | 60 - .../cloud_filestore_manager.get_backup.js | 59 - .../cloud_filestore_manager.get_instance.js | 59 - .../cloud_filestore_manager.list_backups.js | 82 - .../cloud_filestore_manager.list_instances.js | 81 - ...loud_filestore_manager.restore_instance.js | 76 - .../cloud_filestore_manager.update_backup.js | 65 - ...cloud_filestore_manager.update_instance.js | 69 - ...tadata.google.cloud.filestore.v1beta1.json | 523 ----- owl-bot-staging/v1beta1/src/index.ts | 25 - .../v1beta1/cloud_filestore_manager_client.ts | 1856 --------------- ...cloud_filestore_manager_client_config.json | 93 - .../cloud_filestore_manager_proto_list.json | 4 - .../v1beta1/src/v1beta1/gapic_metadata.json | 141 -- owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - .../gapic_cloud_filestore_manager_v1beta1.ts | 2041 ----------------- owl-bot-staging/v1beta1/tsconfig.json | 19 - owl-bot-staging/v1beta1/webpack.config.js | 64 - src/v1/cloud_filestore_manager_client.ts | 53 +- src/v1beta1/cloud_filestore_manager_client.ts | 53 +- 72 files changed, 82 insertions(+), 13211 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/common/operation_metadata.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/filestore/v1/cloud_filestore_service.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_backup.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_backup.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_backup.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_backups.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_instances.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.restore_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_backup.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.filestore.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/cloud_filestore_manager_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/cloud_filestore_manager_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/cloud_filestore_manager_proto_list.json 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/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_cloud_filestore_manager_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/common/operation_metadata.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_backup.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_instance.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_backup.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_instance.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_backup.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_instance.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_backups.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_instances.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.restore_instance.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_backup.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_instance.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.filestore.v1beta1.json delete mode 100644 owl-bot-staging/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client_config.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_proto_list.json 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/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_cloud_filestore_manager_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 52876d4..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/filestore', - 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 048fe77..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Filestore: 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 ff98186..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/filestore", - "version": "0.1.0", - "description": "Filestore client for Node.js", - "repository": "googleapis/nodejs-filestore", - "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 filestore", - "filestore", - "cloud filestore manager" - ], - "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/common/operation_metadata.proto b/owl-bot-staging/v1/protos/google/cloud/common/operation_metadata.proto deleted file mode 100644 index 24300e3..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/common/operation_metadata.proto +++ /dev/null @@ -1,53 +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.common; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/common;common"; -option java_multiple_files = true; -option java_package = "com.google.cloud.common"; - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // 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. Human-readable status of the operation, if any. - string status_detail = 5 [(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][] of 1, - // corresponding to `Code.CANCELLED`. - bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/filestore/v1/cloud_filestore_service.proto b/owl-bot-staging/v1/protos/google/cloud/filestore/v1/cloud_filestore_service.proto deleted file mode 100644 index 676fa0b..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/filestore/v1/cloud_filestore_service.proto +++ /dev/null @@ -1,718 +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.filestore.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/common/operation_metadata.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.Filestore.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/filestore/v1;filestore"; -option java_multiple_files = true; -option java_outer_classname = "CloudFilestoreServiceProto"; -option java_package = "com.google.cloud.filestore.v1"; -option php_namespace = "Google\\Cloud\\Filestore\\V1"; - -// Configures and manages Cloud Filestore resources. -// -// Cloud Filestore Manager v1. -// -// The `file.googleapis.com` service implements the Cloud Filestore API and -// defines the following resource model for managing instances: -// * The service works with a collection of cloud projects, named: `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// * Each location has a collection of instances and backups, named: -// `/instances/*` and `/backups/*` respectively. -// * As such, Cloud Filestore instances are resources of the form: -// `/projects/{project_number}/locations/{location_id}/instances/{instance_id}` -// and backups are resources of the form: -// `/projects/{project_number}/locations/{location_id}/backup/{backup_id}` -// -// Note that location_id must be a GCP `zone` for instances and but to a GCP -// `region` for backups; for example: -// * `projects/12345/locations/us-central1-c/instances/my-filestore` -// * `projects/12345/locations/us-central1/backups/my-backup` -service CloudFilestoreManager { - option (google.api.default_host) = "file.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all instances in a project for either a specified location - // or for all locations. - rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/instances" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a specific instance. - rpc GetInstance(GetInstanceRequest) returns (Instance) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates an instance. - // When creating from a backup, the capacity of the new instance needs to be - // equal to or larger than the capacity of the backup (and also equal to or - // larger than the minimum capacity of the tier). - rpc CreateInstance(CreateInstanceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/instances" - body: "instance" - }; - option (google.api.method_signature) = "parent,instance,instance_id"; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Updates the settings of a specific instance. - rpc UpdateInstance(UpdateInstanceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{instance.name=projects/*/locations/*/instances/*}" - body: "instance" - }; - option (google.api.method_signature) = "instance,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Restores an existing instance's file share from a backup. - // - // The capacity of the instance needs to be equal to or larger than the - // capacity of the backup (and also equal to or larger than the minimum - // capacity of the tier). - rpc RestoreInstance(RestoreInstanceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/instances/*}:restore" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Deletes an instance. - rpc DeleteInstance(DeleteInstanceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Lists all backups in a project for either a specified location or for all - // locations. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a specific backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a backup. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup,backup_id"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Deletes a backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Updates the settings of a specific backup. - rpc UpdateBackup(UpdateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{backup.name=projects/*/locations/*/backups/*}" - body: "backup" - }; - option (google.api.method_signature) = "backup,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } -} - -// Network configuration for the instance. -message NetworkConfig { - // Internet protocol versions supported by Cloud Filestore. - enum AddressMode { - // Internet protocol not set. - ADDRESS_MODE_UNSPECIFIED = 0; - - // Use the IPv4 internet protocol. - MODE_IPV4 = 1; - } - - // The name of the Google Compute Engine - // [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the - // instance is connected. - string network = 1; - - // Internet protocol versions for which the instance has IP addresses - // assigned. For this version, only MODE_IPV4 is supported. - repeated AddressMode modes = 3; - - // A /29 CIDR block in one of the - // [internal IP address - // ranges](https://www.arin.net/reference/research/statistics/address_filters/) - // that identifies the range of IP addresses reserved for this instance. For - // example, 10.0.0.0/29 or 192.168.0.0/29. The range you specify can't overlap - // with either existing subnets or assigned IP address ranges for other Cloud - // Filestore instances in the selected VPC network. - string reserved_ip_range = 4; - - // Output only. IPv4 addresses in the format - // IPv4 addresses in the format `{octet1}.{octet2}.{octet3}.{octet4}` or - // IPv6 addresses in the format - // `{block1}:{block2}:{block3}:{block4}:{block5}:{block6}:{block7}:{block8}`. - repeated string ip_addresses = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// File share configuration for the instance. -message FileShareConfig { - // The name of the file share (must be 16 characters or less). - string name = 1; - - // File share capacity in gigabytes (GB). - // Cloud Filestore defines 1 GB as 1024^3 bytes. - int64 capacity_gb = 2; - - // The source that this file share has been restored from. Empty if the file - // share is created from scratch. - oneof source { - // The resource name of the backup, in the format - // `projects/{project_number}/locations/{location_id}/backups/{backup_id}`, - // that this file share has been restored from. - string source_backup = 8 [ - (google.api.resource_reference) = { type: "file.googleapis.com/Backup" } - ]; - } - - // Nfs Export Options. - // There is a limit of 10 export options per file share. - repeated NfsExportOptions nfs_export_options = 7; -} - -// NFS export options specifications. -message NfsExportOptions { - // The access mode. - enum AccessMode { - // AccessMode not set. - ACCESS_MODE_UNSPECIFIED = 0; - - // The client can only read the file share. - READ_ONLY = 1; - - // The client can read and write the file share (default). - READ_WRITE = 2; - } - - // The squash mode. - enum SquashMode { - // SquashMode not set. - SQUASH_MODE_UNSPECIFIED = 0; - - // The Root user has root access to the file share (default). - NO_ROOT_SQUASH = 1; - - // The Root user has squashed access to the anonymous uid/gid. - ROOT_SQUASH = 2; - } - - // List of either an IPv4 addresses in the format - // `{octet1}.{octet2}.{octet3}.{octet4}` or CIDR ranges in the format - // `{octet1}.{octet2}.{octet3}.{octet4}/{mask size}` which may mount the - // file share. - // Overlapping IP ranges are not allowed, both within and across - // NfsExportOptions. An error will be returned. - // The limit is 64 IP ranges/addresses for each FileShareConfig among all - // NfsExportOptions. - repeated string ip_ranges = 1; - - // Either READ_ONLY, for allowing only read requests on the exported - // directory, or READ_WRITE, for allowing both read and write requests. - // The default is READ_WRITE. - AccessMode access_mode = 2; - - // Either NO_ROOT_SQUASH, for allowing root access on the exported directory, - // or ROOT_SQUASH, for not allowing root access. The default is - // NO_ROOT_SQUASH. - SquashMode squash_mode = 3; - - // An integer representing the anonymous user id with a default value of - // 65534. - // Anon_uid may only be set with squash_mode of ROOT_SQUASH. An error will be - // returned if this field is specified for other squash_mode settings. - int64 anon_uid = 4; - - // An integer representing the anonymous group id with a default value of - // 65534. - // Anon_gid may only be set with squash_mode of ROOT_SQUASH. An error will be - // returned if this field is specified for other squash_mode settings. - int64 anon_gid = 5; -} - -// A Cloud Filestore instance. -message Instance { - option (google.api.resource) = { - type: "file.googleapis.com/Instance" - pattern: "projects/{project}/locations/{location}/instances/{instance}" - }; - - // The instance state. - enum State { - // State not set. - STATE_UNSPECIFIED = 0; - - // The instance is being created. - CREATING = 1; - - // The instance is available for use. - READY = 2; - - // Work is being done on the instance. You can get further details from the - // `statusMessage` field of the `Instance` resource. - REPAIRING = 3; - - // The instance is shutting down. - DELETING = 4; - - // The instance is experiencing an issue and might be unusable. You can get - // further details from the `statusMessage` field of the `Instance` - // resource. - ERROR = 6; - - // The instance is restoring a backup to an existing file share and may be - // unusable during this time. - RESTORING = 7; - } - - // Available service tiers. - enum Tier { - // Not set. - TIER_UNSPECIFIED = 0; - - // STANDARD tier. - STANDARD = 1; - - // PREMIUM tier. - PREMIUM = 2; - - // BASIC instances offer a maximum capacity of 63.9 TB. - // BASIC_HDD is an alias for STANDARD Tier, offering economical - // performance backed by HDD. - BASIC_HDD = 3; - - // BASIC instances offer a maximum capacity of 63.9 TB. - // BASIC_SSD is an alias for PREMIUM Tier, and offers improved - // performance backed by SSD. - BASIC_SSD = 4; - - // HIGH_SCALE instances offer expanded capacity and performance scaling - // capabilities. - HIGH_SCALE_SSD = 5; - } - - // Output only. The resource name of the instance, in the format - // `projects/{project}/locations/{location}/instances/{instance}`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of the instance (2048 characters or less). - string description = 2; - - // Output only. The instance state. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the instance state, if available. - string status_message = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the instance was created. - google.protobuf.Timestamp create_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The service tier of the instance. - Tier tier = 8; - - // Resource labels to represent user provided metadata. - map labels = 9; - - // File system shares on the instance. - // For this version, only a single file share is supported. - repeated FileShareConfig file_shares = 10; - - // VPC networks to which the instance is connected. - // For this version, only a single network is supported. - repeated NetworkConfig networks = 11; - - // Server-specified ETag for the instance resource to prevent simultaneous - // updates from overwriting each other. - string etag = 12; - - // Output only. Reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// CreateInstanceRequest creates an instance. -message CreateInstanceRequest { - // Required. The instance's project and location, in the format - // `projects/{project_id}/locations/{location}`. In Cloud Filestore, - // locations map to GCP zones, for example **us-west1-b**. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The name of the instance to create. - // The name must be unique for the specified project and location. - string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. An [instance resource][google.cloud.filestore.v1.Instance] - Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// GetInstanceRequest gets the state of an instance. -message GetInstanceRequest { - // Required. The instance resource name, in the format - // `projects/{project_id}/locations/{location}/instances/{instance_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "file.googleapis.com/Instance" } - ]; -} - -// UpdateInstanceRequest updates the settings of an instance. -message UpdateInstanceRequest { - // Mask of fields to update. At least one path must be supplied in this - // field. The elements of the repeated paths field may only include these - // fields: - // - // * "description" - // * "file_shares" - // * "labels" - google.protobuf.FieldMask update_mask = 1; - - // Only fields specified in update_mask are updated. - Instance instance = 2; -} - -// RestoreInstanceRequest restores an existing instances's file share from a -// backup. -message RestoreInstanceRequest { - // Required. The resource name of the instance, in the format - // `projects/{project_number}/locations/{location_id}/instances/{instance_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "file.googleapis.com/Instance" } - ]; - - // Required. Name of the file share in the Cloud Filestore instance that the - // backup is being restored to. - string file_share = 2 [(google.api.field_behavior) = REQUIRED]; - - oneof source { - // The resource name of the backup, in the format - // `projects/{project_number}/locations/{location_id}/backups/{backup_id}`. - string source_backup = 3 [ - (google.api.resource_reference) = { type: "file.googleapis.com/Backup" } - ]; - } -} - -// DeleteInstanceRequest deletes an instance. -message DeleteInstanceRequest { - // Required. The instance resource name, in the format - // `projects/{project_id}/locations/{location}/instances/{instance_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "file.googleapis.com/Instance" } - ]; -} - -// ListInstancesRequest lists instances. -message ListInstancesRequest { - // Required. The project and location for which to retrieve instance - // information, in the format `projects/{project_id}/locations/{location}`. In - // Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To - // retrieve instance information for all locations, use "-" for the - // `{location}` value. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value to use if there are additional - // results to retrieve for this list request. - string page_token = 3; - - // Sort results. Supported values are "name", "name desc" or "" (unsorted). - string order_by = 4; - - // List filter. - string filter = 5; -} - -// ListInstancesResponse is the result of ListInstancesRequest. -message ListInstancesResponse { - // A list of instances in the project for the specified location. - // - // If the `{location}` value in the request is "-", the response contains a - // list of instances from all locations. If any location is unreachable, the - // response will only return instances in reachable locations and the - // "unreachable" field will be populated with a list of unreachable locations. - repeated Instance instances = 1; - - // The token you can use to retrieve the next page of results. Not returned - // if there are no more results in the list. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A Cloud Filestore backup. -message Backup { - option (google.api.resource) = { - type: "file.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/backups/{backup}" - }; - - // The backup state. - enum State { - // State not set. - STATE_UNSPECIFIED = 0; - - // Backup is being created. - CREATING = 1; - - // Backup has been taken and the operation is being finalized. At this - // point, changes to the file share will not be reflected in the backup. - FINALIZING = 2; - - // Backup is available for use. - READY = 3; - - // Backup is being deleted. - DELETING = 4; - } - - // Output only. The resource name of the backup, in the format - // `projects/{project_number}/locations/{location_id}/backups/{backup_id}`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A description of the backup with 2048 characters or less. - // Requests with longer descriptions will be rejected. - string description = 2; - - // Output only. The backup state. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the backup was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Resource labels to represent user provided metadata. - map labels = 5; - - // Output only. Capacity of the source file share when the backup was created. - int64 capacity_gb = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The size of the storage used by the backup. As backups share - // storage, this number is expected to change with backup creation/deletion. - int64 storage_bytes = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The resource name of the source Cloud Filestore instance, in the format - // `projects/{project_number}/locations/{location_id}/instances/{instance_id}`, - // used to create this backup. - string source_instance = 8 [ - (google.api.resource_reference) = { type: "file.googleapis.com/Instance" } - ]; - - // Name of the file share in the source Cloud Filestore instance that the - // backup is created from. - string source_file_share = 9; - - // Output only. The service tier of the source Cloud Filestore instance that - // this backup is created from. - Instance.Tier source_instance_tier = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Amount of bytes that will be downloaded if the backup is - // restored. This may be different than storage bytes, since sequential - // backups of the same disk will share storage. - int64 download_bytes = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// CreateBackupRequest creates a backup. -message CreateBackupRequest { - // Required. The backup's project and location, in the format - // `projects/{project_number}/locations/{location}`. In Cloud Filestore, - // backup locations map to GCP regions, for example **us-west1**. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. A [backup resource][google.cloud.filestore.v1.Backup] - Backup backup = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the backup. - // The ID must be unique within the specified project and location. - // - // This value must start with a lowercase letter followed by up to 62 - // lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - // Values that do not match this pattern will trigger an INVALID_ARGUMENT - // error. - string backup_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// DeleteBackupRequest deletes a backup. -message DeleteBackupRequest { - // Required. The backup resource name, in the format - // `projects/{project_number}/locations/{location}/backups/{backup_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "file.googleapis.com/Backup" } - ]; -} - -// UpdateBackupRequest updates description and/or labels for a backup. -message UpdateBackupRequest { - // Required. A [backup resource][google.cloud.filestore.v1.Backup] - Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask of fields to update. At least one path must be supplied in - // this field. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// GetBackupRequest gets the state of a backup. -message GetBackupRequest { - // Required. The backup resource name, in the format - // `projects/{project_number}/locations/{location}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "file.googleapis.com/Backup" } - ]; -} - -// ListBackupsRequest lists backups. -message ListBackupsRequest { - // Required. The project and location for which to retrieve backup - // information, in the format - // `projects/{project_number}/locations/{location}`. In Cloud Filestore, - // backup locations map to GCP regions, for example **us-west1**. To retrieve - // backup information for all locations, use "-" for the - // `{location}` value. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value to use if there are additional - // results to retrieve for this list request. - string page_token = 3; - - // Sort results. Supported values are "name", "name desc" or "" (unsorted). - string order_by = 4; - - // List filter. - string filter = 5; -} - -// ListBackupsResponse is the result of ListBackupsRequest. -message ListBackupsResponse { - // A list of backups in the project for the specified location. - // - // If the `{location}` value in the request is "-", the response contains a - // list of backups from all locations. If any location is unreachable, the - // response will only return backups in reachable locations and the - // "unreachable" field will be populated with a list of unreachable - // locations. - repeated Backup backups = 1; - - // The token you can use to retrieve the next page of results. Not returned - // if there are no more results in the list. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_backup.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_backup.js deleted file mode 100644 index 522528e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_backup.js +++ /dev/null @@ -1,76 +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, backup, backupId) { - // [START file_v1_generated_CloudFilestoreManager_CreateBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The backup's project and location, in the format - * `projects/{project_number}/locations/{location}`. In Cloud Filestore, - * backup locations map to GCP regions, for example **us-west1**. - */ - // const parent = 'abc123' - /** - * Required. A backup resource google.cloud.filestore.v1.Backup - */ - // const backup = {} - /** - * Required. The ID to use for the backup. - * The ID must be unique within the specified project and location. - * This value must start with a lowercase letter followed by up to 62 - * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - * Values that do not match this pattern will trigger an INVALID_ARGUMENT - * error. - */ - // const backupId = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backup, - backupId, - }; - - // Run request - const [operation] = await filestoreClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END file_v1_generated_CloudFilestoreManager_CreateBackup_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/cloud_filestore_manager.create_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_instance.js deleted file mode 100644 index f1ee31a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.create_instance.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(parent, instanceId, instance) { - // [START file_v1_generated_CloudFilestoreManager_CreateInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The instance's project and location, in the format - * `projects/{project_id}/locations/{location}`. In Cloud Filestore, - * locations map to GCP zones, for example **us-west1-b**. - */ - // const parent = 'abc123' - /** - * Required. The name of the instance to create. - * The name must be unique for the specified project and location. - */ - // const instanceId = 'abc123' - /** - * Required. An instance resource google.cloud.filestore.v1.Instance - */ - // const instance = {} - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callCreateInstance() { - // Construct request - const request = { - parent, - instanceId, - instance, - }; - - // Run request - const [operation] = await filestoreClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateInstance(); - // [END file_v1_generated_CloudFilestoreManager_CreateInstance_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/cloud_filestore_manager.delete_backup.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_backup.js deleted file mode 100644 index e7a3f85..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_backup.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 file_v1_generated_CloudFilestoreManager_DeleteBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The backup resource name, in the format - * `projects/{project_number}/locations/{location}/backups/{backup_id}` - */ - // const name = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await filestoreClient.deleteBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackup(); - // [END file_v1_generated_CloudFilestoreManager_DeleteBackup_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/cloud_filestore_manager.delete_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_instance.js deleted file mode 100644 index 160d130..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.delete_instance.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 file_v1_generated_CloudFilestoreManager_DeleteInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The instance resource name, in the format - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - */ - // const name = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callDeleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await filestoreClient.deleteInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteInstance(); - // [END file_v1_generated_CloudFilestoreManager_DeleteInstance_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/cloud_filestore_manager.get_backup.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_backup.js deleted file mode 100644 index dbf6552..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_backup.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 file_v1_generated_CloudFilestoreManager_GetBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The backup resource name, in the format - * `projects/{project_number}/locations/{location}/backups/{backup_id}`. - */ - // const name = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await filestoreClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END file_v1_generated_CloudFilestoreManager_GetBackup_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/cloud_filestore_manager.get_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_instance.js deleted file mode 100644 index 64c7a26..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.get_instance.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 file_v1_generated_CloudFilestoreManager_GetInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The instance resource name, in the format - * `projects/{project_id}/locations/{location}/instances/{instance_id}`. - */ - // const name = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callGetInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await filestoreClient.getInstance(request); - console.log(response); - } - - callGetInstance(); - // [END file_v1_generated_CloudFilestoreManager_GetInstance_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/cloud_filestore_manager.list_backups.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_backups.js deleted file mode 100644 index 37fe213..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_backups.js +++ /dev/null @@ -1,82 +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 file_v1_generated_CloudFilestoreManager_ListBackups_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project and location for which to retrieve backup - * information, in the format - * `projects/{project_number}/locations/{location}`. In Cloud Filestore, - * backup locations map to GCP regions, for example **us-west1**. To retrieve - * backup information for all locations, use "-" for the - * `{location}` value. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - */ - // const pageToken = 'abc123' - /** - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - */ - // const orderBy = 'abc123' - /** - * List filter. - */ - // const filter = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await filestoreClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END file_v1_generated_CloudFilestoreManager_ListBackups_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/cloud_filestore_manager.list_instances.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_instances.js deleted file mode 100644 index 800afa0..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.list_instances.js +++ /dev/null @@ -1,81 +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 file_v1_generated_CloudFilestoreManager_ListInstances_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project and location for which to retrieve instance - * information, in the format `projects/{project_id}/locations/{location}`. In - * Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To - * retrieve instance information for all locations, use "-" for the - * `{location}` value. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - */ - // const pageToken = 'abc123' - /** - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - */ - // const orderBy = 'abc123' - /** - * List filter. - */ - // const filter = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callListInstances() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await filestoreClient.listInstancesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListInstances(); - // [END file_v1_generated_CloudFilestoreManager_ListInstances_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/cloud_filestore_manager.restore_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.restore_instance.js deleted file mode 100644 index 2be0689..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.restore_instance.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(name, fileShare) { - // [START file_v1_generated_CloudFilestoreManager_RestoreInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance, in the format - * `projects/{project_number}/locations/{location_id}/instances/{instance_id}`. - */ - // const name = 'abc123' - /** - * Required. Name of the file share in the Cloud Filestore instance that the - * backup is being restored to. - */ - // const fileShare = 'abc123' - /** - * The resource name of the backup, in the format - * `projects/{project_number}/locations/{location_id}/backups/{backup_id}`. - */ - // const sourceBackup = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callRestoreInstance() { - // Construct request - const request = { - name, - fileShare, - }; - - // Run request - const [operation] = await filestoreClient.restoreInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreInstance(); - // [END file_v1_generated_CloudFilestoreManager_RestoreInstance_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/cloud_filestore_manager.update_backup.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_backup.js deleted file mode 100644 index 153cf08..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_backup.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(backup, updateMask) { - // [START file_v1_generated_CloudFilestoreManager_UpdateBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A backup resource google.cloud.filestore.v1.Backup - */ - // const backup = {} - /** - * Required. Mask of fields to update. At least one path must be supplied in - * this field. - */ - // const updateMask = {} - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callUpdateBackup() { - // Construct request - const request = { - backup, - updateMask, - }; - - // Run request - const [operation] = await filestoreClient.updateBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateBackup(); - // [END file_v1_generated_CloudFilestoreManager_UpdateBackup_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/cloud_filestore_manager.update_instance.js b/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_instance.js deleted file mode 100644 index 80af363..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_filestore_manager.update_instance.js +++ /dev/null @@ -1,67 +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() { - // [START file_v1_generated_CloudFilestoreManager_UpdateInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include these - * fields: - * * "description" - * * "file_shares" - * * "labels" - */ - // const updateMask = {} - /** - * Only fields specified in update_mask are updated. - */ - // const instance = {} - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callUpdateInstance() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await filestoreClient.updateInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateInstance(); - // [END file_v1_generated_CloudFilestoreManager_UpdateInstance_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.filestore.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.filestore.v1.json deleted file mode 100644 index 8ff56c3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.filestore.v1.json +++ /dev/null @@ -1,519 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-filestore", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.filestore.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "file_v1_generated_CloudFilestoreManager_ListInstances_async", - "title": "CloudFilestoreManager listInstances Sample", - "origin": "API_DEFINITION", - "description": " Lists all instances in a project for either a specified location or for all locations.", - "canonical": true, - "file": "cloud_filestore_manager.list_instances.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInstances", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.ListInstances", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.filestore.v1.ListInstancesResponse", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "ListInstances", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.ListInstances", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_GetInstance_async", - "title": "CloudFilestoreManager getInstance Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a specific instance.", - "canonical": true, - "file": "cloud_filestore_manager.get_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.GetInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.filestore.v1.Instance", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "GetInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.GetInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_CreateInstance_async", - "title": "CloudFilestoreManager createInstance Sample", - "origin": "API_DEFINITION", - "description": " Creates an instance. When creating from a backup, the capacity of the new instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).", - "canonical": true, - "file": "cloud_filestore_manager.create_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.CreateInstance", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "instance_id", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": ".google.cloud.filestore.v1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "CreateInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.CreateInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_UpdateInstance_async", - "title": "CloudFilestoreManager updateInstance Sample", - "origin": "API_DEFINITION", - "description": " Updates the settings of a specific instance.", - "canonical": true, - "file": "cloud_filestore_manager.update_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.UpdateInstance", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "instance", - "type": ".google.cloud.filestore.v1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.UpdateInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_RestoreInstance_async", - "title": "CloudFilestoreManager restoreInstance Sample", - "origin": "API_DEFINITION", - "description": " Restores an existing instance's file share from a backup. The capacity of the instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).", - "canonical": true, - "file": "cloud_filestore_manager.restore_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.RestoreInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "file_share", - "type": "TYPE_STRING" - }, - { - "name": "source_backup", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "RestoreInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.RestoreInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_DeleteInstance_async", - "title": "CloudFilestoreManager deleteInstance Sample", - "origin": "API_DEFINITION", - "description": " Deletes an instance.", - "canonical": true, - "file": "cloud_filestore_manager.delete_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.DeleteInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.DeleteInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_ListBackups_async", - "title": "CloudFilestoreManager listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists all backups in a project for either a specified location or for all locations.", - "canonical": true, - "file": "cloud_filestore_manager.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.filestore.v1.ListBackupsResponse", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.ListBackups", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_GetBackup_async", - "title": "CloudFilestoreManager getBackup Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a specific backup.", - "canonical": true, - "file": "cloud_filestore_manager.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.filestore.v1.Backup", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.GetBackup", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_CreateBackup_async", - "title": "CloudFilestoreManager createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a backup.", - "canonical": true, - "file": "cloud_filestore_manager.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.filestore.v1.Backup" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.CreateBackup", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_DeleteBackup_async", - "title": "CloudFilestoreManager deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a backup.", - "canonical": true, - "file": "cloud_filestore_manager.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.DeleteBackup", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1_generated_CloudFilestoreManager_UpdateBackup_async", - "title": "CloudFilestoreManager updateBackup Sample", - "origin": "API_DEFINITION", - "description": " Updates the settings of a specific backup.", - "canonical": true, - "file": "cloud_filestore_manager.update_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.UpdateBackup", - "async": true, - "parameters": [ - { - "name": "backup", - "type": ".google.cloud.filestore.v1.Backup" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager.UpdateBackup", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1.CloudFilestoreManager" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 1b1b749..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 CloudFilestoreManagerClient = v1.CloudFilestoreManagerClient; -type CloudFilestoreManagerClient = v1.CloudFilestoreManagerClient; -export {v1, CloudFilestoreManagerClient}; -export default {v1, CloudFilestoreManagerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client.ts b/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client.ts deleted file mode 100644 index f03eb31..0000000 --- a/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client.ts +++ /dev/null @@ -1,1784 +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/cloud_filestore_manager_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_filestore_manager_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Configures and manages Cloud Filestore resources. - * - * Cloud Filestore Manager v1. - * - * The `file.googleapis.com` service implements the Cloud Filestore API and - * defines the following resource model for managing instances: - * * The service works with a collection of cloud projects, named: `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * * Each location has a collection of instances and backups, named: - * `/instances/*` and `/backups/*` respectively. - * * As such, Cloud Filestore instances are resources of the form: - * `/projects/{project_number}/locations/{location_id}/instances/{instance_id}` - * and backups are resources of the form: - * `/projects/{project_number}/locations/{location_id}/backup/{backup_id}` - * - * Note that location_id must be a GCP `zone` for instances and but to a GCP - * `region` for backups; for example: - * * `projects/12345/locations/us-central1-c/instances/my-filestore` - * * `projects/12345/locations/us-central1/backups/my-backup` - * @class - * @memberof v1 - */ -export class CloudFilestoreManagerClient { - 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; - cloudFilestoreManagerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudFilestoreManagerClient. - * - * @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 CloudFilestoreManagerClient; - 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 = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backups/{backup}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - }; - - // 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 = { - listInstances: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - 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.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1.Instance') as gax.protobuf.Type; - const createInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const updateInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1.Instance') as gax.protobuf.Type; - const updateInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const restoreInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1.Instance') as gax.protobuf.Type; - const restoreInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const deleteInstanceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const deleteBackupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const updateBackupResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1.Backup') as gax.protobuf.Type; - const updateBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata)), - updateInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateInstanceResponse.decode.bind(updateInstanceResponse), - updateInstanceMetadata.decode.bind(updateInstanceMetadata)), - restoreInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreInstanceResponse.decode.bind(restoreInstanceResponse), - restoreInstanceMetadata.decode.bind(restoreInstanceMetadata)), - deleteInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInstanceResponse.decode.bind(deleteInstanceResponse), - deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - deleteBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupResponse.decode.bind(deleteBackupResponse), - deleteBackupMetadata.decode.bind(deleteBackupMetadata)), - updateBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateBackupResponse.decode.bind(updateBackupResponse), - updateBackupMetadata.decode.bind(updateBackupMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.filestore.v1.CloudFilestoreManager', 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.cloudFilestoreManagerStub) { - return this.cloudFilestoreManagerStub; - } - - // Put together the "service stub" for - // google.cloud.filestore.v1.CloudFilestoreManager. - this.cloudFilestoreManagerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.filestore.v1.CloudFilestoreManager') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.filestore.v1.CloudFilestoreManager, - 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 cloudFilestoreManagerStubMethods = - ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'restoreInstance', 'deleteInstance', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'updateBackup']; - for (const methodName of cloudFilestoreManagerStubMethods) { - const callPromise = this.cloudFilestoreManagerStub.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.cloudFilestoreManagerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'file.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 'file.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 -- - // ------------------- -/** - * Gets the details of a specific instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The instance resource name, in the format - * `projects/{project_id}/locations/{location}/instances/{instance_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Instance]{@link google.cloud.filestore.v1.Instance}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/cloud_filestore_manager.get_instance.js - * region_tag:file_v1_generated_CloudFilestoreManager_GetInstance_async - */ - getInstance( - request?: protos.google.cloud.filestore.v1.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.filestore.v1.IInstance, - protos.google.cloud.filestore.v1.IGetInstanceRequest|undefined, {}|undefined - ]>; - getInstance( - request: protos.google.cloud.filestore.v1.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.filestore.v1.IInstance, - protos.google.cloud.filestore.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request: protos.google.cloud.filestore.v1.IGetInstanceRequest, - callback: Callback< - protos.google.cloud.filestore.v1.IInstance, - protos.google.cloud.filestore.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request?: protos.google.cloud.filestore.v1.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.filestore.v1.IInstance, - protos.google.cloud.filestore.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.filestore.v1.IInstance, - protos.google.cloud.filestore.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.filestore.v1.IInstance, - protos.google.cloud.filestore.v1.IGetInstanceRequest|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.getInstance(request, options, callback); - } -/** - * Gets the details of a specific backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The backup resource name, in the format - * `projects/{project_number}/locations/{location}/backups/{backup_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Backup]{@link google.cloud.filestore.v1.Backup}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/cloud_filestore_manager.get_backup.js - * region_tag:file_v1_generated_CloudFilestoreManager_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.filestore.v1.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.filestore.v1.IBackup, - protos.google.cloud.filestore.v1.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.cloud.filestore.v1.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.filestore.v1.IBackup, - protos.google.cloud.filestore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.cloud.filestore.v1.IGetBackupRequest, - callback: Callback< - protos.google.cloud.filestore.v1.IBackup, - protos.google.cloud.filestore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.cloud.filestore.v1.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.filestore.v1.IBackup, - protos.google.cloud.filestore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.filestore.v1.IBackup, - protos.google.cloud.filestore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.filestore.v1.IBackup, - protos.google.cloud.filestore.v1.IGetBackupRequest|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.getBackup(request, options, callback); - } - -/** - * Creates an instance. - * When creating from a backup, the capacity of the new instance needs to be - * equal to or larger than the capacity of the backup (and also equal to or - * larger than the minimum capacity of the tier). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The instance's project and location, in the format - * `projects/{project_id}/locations/{location}`. In Cloud Filestore, - * locations map to GCP zones, for example **us-west1-b**. - * @param {string} request.instanceId - * Required. The name of the instance to create. - * The name must be unique for the specified project and location. - * @param {google.cloud.filestore.v1.Instance} request.instance - * Required. An {@link google.cloud.filestore.v1.Instance|instance 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/cloud_filestore_manager.create_instance.js - * region_tag:file_v1_generated_CloudFilestoreManager_CreateInstance_async - */ - createInstance( - request?: protos.google.cloud.filestore.v1.ICreateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createInstance( - request: protos.google.cloud.filestore.v1.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request: protos.google.cloud.filestore.v1.ICreateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request?: protos.google.cloud.filestore.v1.ICreateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - 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.createInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_filestore_manager.create_instance.js - * region_tag:file_v1_generated_CloudFilestoreManager_CreateInstance_async - */ - async checkCreateInstanceProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the settings of a specific instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask of fields to update. At least one path must be supplied in this - * field. The elements of the repeated paths field may only include these - * fields: - * - * * "description" - * * "file_shares" - * * "labels" - * @param {google.cloud.filestore.v1.Instance} request.instance - * Only 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/cloud_filestore_manager.update_instance.js - * region_tag:file_v1_generated_CloudFilestoreManager_UpdateInstance_async - */ - updateInstance( - request?: protos.google.cloud.filestore.v1.IUpdateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateInstance( - request: protos.google.cloud.filestore.v1.IUpdateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request: protos.google.cloud.filestore.v1.IUpdateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request?: protos.google.cloud.filestore.v1.IUpdateInstanceRequest, - 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({ - 'instance.name': request.instance!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateInstance()`. - * @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/cloud_filestore_manager.update_instance.js - * region_tag:file_v1_generated_CloudFilestoreManager_UpdateInstance_async - */ - async checkUpdateInstanceProgress(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.updateInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restores an existing instance's file share from a backup. - * - * The capacity of the instance needs to be equal to or larger than the - * capacity of the backup (and also equal to or larger than the minimum - * capacity of the tier). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the instance, in the format - * `projects/{project_number}/locations/{location_id}/instances/{instance_id}`. - * @param {string} request.fileShare - * Required. Name of the file share in the Cloud Filestore instance that the - * backup is being restored to. - * @param {string} request.sourceBackup - * The resource name of the backup, in the format - * `projects/{project_number}/locations/{location_id}/backups/{backup_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * 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/cloud_filestore_manager.restore_instance.js - * region_tag:file_v1_generated_CloudFilestoreManager_RestoreInstance_async - */ - restoreInstance( - request?: protos.google.cloud.filestore.v1.IRestoreInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreInstance( - request: protos.google.cloud.filestore.v1.IRestoreInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreInstance( - request: protos.google.cloud.filestore.v1.IRestoreInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreInstance( - request?: protos.google.cloud.filestore.v1.IRestoreInstanceRequest, - 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.restoreInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreInstance()`. - * @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/cloud_filestore_manager.restore_instance.js - * region_tag:file_v1_generated_CloudFilestoreManager_RestoreInstance_async - */ - async checkRestoreInstanceProgress(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.restoreInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The instance resource name, in the format - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * 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/cloud_filestore_manager.delete_instance.js - * region_tag:file_v1_generated_CloudFilestoreManager_DeleteInstance_async - */ - deleteInstance( - request?: protos.google.cloud.filestore.v1.IDeleteInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteInstance( - request: protos.google.cloud.filestore.v1.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request: protos.google.cloud.filestore.v1.IDeleteInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request?: protos.google.cloud.filestore.v1.IDeleteInstanceRequest, - 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.deleteInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteInstance()`. - * @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/cloud_filestore_manager.delete_instance.js - * region_tag:file_v1_generated_CloudFilestoreManager_DeleteInstance_async - */ - async checkDeleteInstanceProgress(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.deleteInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The backup's project and location, in the format - * `projects/{project_number}/locations/{location}`. In Cloud Filestore, - * backup locations map to GCP regions, for example **us-west1**. - * @param {google.cloud.filestore.v1.Backup} request.backup - * Required. A {@link google.cloud.filestore.v1.Backup|backup resource} - * @param {string} request.backupId - * Required. The ID to use for the backup. - * The ID must be unique within the specified project and location. - * - * This value must start with a lowercase letter followed by up to 62 - * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - * Values that do not match this pattern will trigger an INVALID_ARGUMENT - * error. - * @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/cloud_filestore_manager.create_backup.js - * region_tag:file_v1_generated_CloudFilestoreManager_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.filestore.v1.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.cloud.filestore.v1.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.cloud.filestore.v1.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.cloud.filestore.v1.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - 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.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_filestore_manager.create_backup.js - * region_tag:file_v1_generated_CloudFilestoreManager_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBackup, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The backup resource name, in the format - * `projects/{project_number}/locations/{location}/backups/{backup_id}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * 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/cloud_filestore_manager.delete_backup.js - * region_tag:file_v1_generated_CloudFilestoreManager_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.filestore.v1.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.cloud.filestore.v1.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.cloud.filestore.v1.IDeleteBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.cloud.filestore.v1.IDeleteBackupRequest, - 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.deleteBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackup()`. - * @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/cloud_filestore_manager.delete_backup.js - * region_tag:file_v1_generated_CloudFilestoreManager_DeleteBackup_async - */ - async checkDeleteBackupProgress(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.deleteBackup, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the settings of a specific backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.filestore.v1.Backup} request.backup - * Required. A {@link google.cloud.filestore.v1.Backup|backup resource} - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. - * @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/cloud_filestore_manager.update_backup.js - * region_tag:file_v1_generated_CloudFilestoreManager_UpdateBackup_async - */ - updateBackup( - request?: protos.google.cloud.filestore.v1.IUpdateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateBackup( - request: protos.google.cloud.filestore.v1.IUpdateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBackup( - request: protos.google.cloud.filestore.v1.IUpdateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBackup( - request?: protos.google.cloud.filestore.v1.IUpdateBackupRequest, - 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({ - 'backup.name': request.backup!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateBackup()`. - * @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/cloud_filestore_manager.update_backup.js - * region_tag:file_v1_generated_CloudFilestoreManager_UpdateBackup_async - */ - async checkUpdateBackupProgress(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.updateBackup, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all instances in a project for either a specified location - * or for all locations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location for which to retrieve instance - * information, in the format `projects/{project_id}/locations/{location}`. In - * Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To - * retrieve instance information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Instance]{@link google.cloud.filestore.v1.Instance}. - * 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 `listInstancesAsync()` - * 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. - */ - listInstances( - request?: protos.google.cloud.filestore.v1.IListInstancesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.filestore.v1.IInstance[], - protos.google.cloud.filestore.v1.IListInstancesRequest|null, - protos.google.cloud.filestore.v1.IListInstancesResponse - ]>; - listInstances( - request: protos.google.cloud.filestore.v1.IListInstancesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.filestore.v1.IListInstancesRequest, - protos.google.cloud.filestore.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.filestore.v1.IInstance>): void; - listInstances( - request: protos.google.cloud.filestore.v1.IListInstancesRequest, - callback: PaginationCallback< - protos.google.cloud.filestore.v1.IListInstancesRequest, - protos.google.cloud.filestore.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.filestore.v1.IInstance>): void; - listInstances( - request?: protos.google.cloud.filestore.v1.IListInstancesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.filestore.v1.IListInstancesRequest, - protos.google.cloud.filestore.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.filestore.v1.IInstance>, - callback?: PaginationCallback< - protos.google.cloud.filestore.v1.IListInstancesRequest, - protos.google.cloud.filestore.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.filestore.v1.IInstance>): - Promise<[ - protos.google.cloud.filestore.v1.IInstance[], - protos.google.cloud.filestore.v1.IListInstancesRequest|null, - protos.google.cloud.filestore.v1.IListInstancesResponse - ]>|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.listInstances(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 project and location for which to retrieve instance - * information, in the format `projects/{project_id}/locations/{location}`. In - * Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To - * retrieve instance information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Instance]{@link google.cloud.filestore.v1.Instance} 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 `listInstancesAsync()` - * 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. - */ - listInstancesStream( - request?: protos.google.cloud.filestore.v1.IListInstancesRequest, - 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['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInstances.createStream( - this.innerApiCalls.listInstances as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listInstances`, 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 project and location for which to retrieve instance - * information, in the format `projects/{project_id}/locations/{location}`. In - * Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To - * retrieve instance information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Instance]{@link google.cloud.filestore.v1.Instance}. 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/cloud_filestore_manager.list_instances.js - * region_tag:file_v1_generated_CloudFilestoreManager_ListInstances_async - */ - listInstancesAsync( - request?: protos.google.cloud.filestore.v1.IListInstancesRequest, - 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['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInstances.asyncIterate( - this.innerApiCalls['listInstances'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists all backups in a project for either a specified location or for all - * locations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location for which to retrieve backup - * information, in the format - * `projects/{project_number}/locations/{location}`. In Cloud Filestore, - * backup locations map to GCP regions, for example **us-west1**. To retrieve - * backup information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Backup]{@link google.cloud.filestore.v1.Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.filestore.v1.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.filestore.v1.IBackup[], - protos.google.cloud.filestore.v1.IListBackupsRequest|null, - protos.google.cloud.filestore.v1.IListBackupsResponse - ]>; - listBackups( - request: protos.google.cloud.filestore.v1.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.filestore.v1.IListBackupsRequest, - protos.google.cloud.filestore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.filestore.v1.IBackup>): void; - listBackups( - request: protos.google.cloud.filestore.v1.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.filestore.v1.IListBackupsRequest, - protos.google.cloud.filestore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.filestore.v1.IBackup>): void; - listBackups( - request?: protos.google.cloud.filestore.v1.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.filestore.v1.IListBackupsRequest, - protos.google.cloud.filestore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.filestore.v1.IBackup>, - callback?: PaginationCallback< - protos.google.cloud.filestore.v1.IListBackupsRequest, - protos.google.cloud.filestore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.filestore.v1.IBackup>): - Promise<[ - protos.google.cloud.filestore.v1.IBackup[], - protos.google.cloud.filestore.v1.IListBackupsRequest|null, - protos.google.cloud.filestore.v1.IListBackupsResponse - ]>|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.listBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location for which to retrieve backup - * information, in the format - * `projects/{project_number}/locations/{location}`. In Cloud Filestore, - * backup locations map to GCP regions, for example **us-west1**. To retrieve - * backup information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Backup]{@link google.cloud.filestore.v1.Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.filestore.v1.IListBackupsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location for which to retrieve backup - * information, in the format - * `projects/{project_number}/locations/{location}`. In Cloud Filestore, - * backup locations map to GCP regions, for example **us-west1**. To retrieve - * backup information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Backup]{@link google.cloud.filestore.v1.Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/cloud_filestore_manager.list_backups.js - * region_tag:file_v1_generated_CloudFilestoreManager_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.filestore.v1.IListBackupsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: 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; - } - - /** - * 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.cloudFilestoreManagerStub && !this._terminated) { - return this.cloudFilestoreManagerStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client_config.json b/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client_config.json deleted file mode 100644 index fc1ccfd..0000000 --- a/owl-bot-staging/v1/src/v1/cloud_filestore_manager_client_config.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "interfaces": { - "google.cloud.filestore.v1.CloudFilestoreManager": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "9442ca297df43f7314712e1a19d003838e738a45": { - "initial_retry_delay_millis": 250, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 32000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListInstances": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "GetInstance": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "CreateInstance": { - "timeout_millis": 60000000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateInstance": { - "timeout_millis": 14400000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreInstance": { - "timeout_millis": 60000000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInstance": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "CreateBackup": { - "timeout_millis": 60000000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBackup": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/cloud_filestore_manager_proto_list.json b/owl-bot-staging/v1/src/v1/cloud_filestore_manager_proto_list.json deleted file mode 100644 index b5434ce..0000000 --- a/owl-bot-staging/v1/src/v1/cloud_filestore_manager_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/common/operation_metadata.proto", - "../../protos/google/cloud/filestore/v1/cloud_filestore_service.proto" -] 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 92789f7..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.filestore.v1", - "libraryPackage": "@google-cloud/filestore", - "services": { - "CloudFilestoreManager": { - "clients": { - "grpc": { - "libraryClient": "CloudFilestoreManagerClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "RestoreInstance": { - "methods": [ - "restoreInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "ListInstances": { - "methods": [ - "listInstances", - "listInstancesStream", - "listInstancesAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CloudFilestoreManagerClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "RestoreInstance": { - "methods": [ - "restoreInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "ListInstances": { - "methods": [ - "listInstances", - "listInstancesStream", - "listInstancesAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - } - } -} 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 1ea2142..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 {CloudFilestoreManagerClient} from './cloud_filestore_manager_client'; 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 987a396..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 filestore = require('@google-cloud/filestore'); - -function main() { - const cloudFilestoreManagerClient = new filestore.CloudFilestoreManagerClient(); -} - -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 d9a17a4..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 {CloudFilestoreManagerClient} from '@google-cloud/filestore'; - -// check that the client class type name can be used -function doStuffWithCloudFilestoreManagerClient(client: CloudFilestoreManagerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudFilestoreManagerClient = new CloudFilestoreManagerClient(); - doStuffWithCloudFilestoreManagerClient(cloudFilestoreManagerClient); -} - -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_cloud_filestore_manager_v1.ts b/owl-bot-staging/v1/test/gapic_cloud_filestore_manager_v1.ts deleted file mode 100644 index 694e8c4..0000000 --- a/owl-bot-staging/v1/test/gapic_cloud_filestore_manager_v1.ts +++ /dev/null @@ -1,1987 +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 cloudfilestoremanagerModule 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.CloudFilestoreManagerClient', () => { - it('has servicePath', () => { - const servicePath = cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudFilestoreManagerStub, undefined); - await client.initialize(); - assert(client.cloudFilestoreManagerStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.cloudFilestoreManagerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudFilestoreManagerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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 cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.cloud.filestore.v1.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getInstance with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - assert((client.innerApiCalls.getInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetInstanceRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.filestore.v1.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getBackup with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - assert((client.innerApiCalls.getBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.GetBackupRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createInstance with call error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInstance(request), expectedError); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createInstance with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateInstance', () => { - it('invokes updateInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInstance( - 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.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateInstance with call error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInstance(request), expectedError); - assert((client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateInstance with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateInstanceProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkUpdateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateInstanceProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkUpdateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreInstance', () => { - it('invokes restoreInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.RestoreInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.RestoreInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreInstance( - 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.restoreInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes restoreInstance with call error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.RestoreInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreInstance(request), expectedError); - assert((client.innerApiCalls.restoreInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreInstance with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.RestoreInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.restoreInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRestoreInstanceProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkRestoreInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreInstanceProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkRestoreInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - 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.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteInstance with call error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInstance(request), expectedError); - assert((client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteInstance with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteInstanceProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkDeleteInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteInstanceProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkDeleteInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createBackup with call error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - 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.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteBackup with call error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - assert((client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBackup with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackup(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteBackupProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkDeleteBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkDeleteBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateBackup', () => { - it('invokes updateBackup without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBackup without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackup( - 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.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateBackup with call error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateBackup(request), expectedError); - assert((client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBackup with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateBackup(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateBackupProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkUpdateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateBackupProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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.checkUpdateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listInstances', () => { - it('invokes listInstances without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); - const [response] = await client.listInstances(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listInstances as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listInstances without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInstances( - request, - (err?: Error|null, result?: protos.google.cloud.filestore.v1.IInstance[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listInstances as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listInstances with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInstances(request), expectedError); - assert((client.innerApiCalls.listInstances as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listInstancesStream without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - ]; - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.filestore.v1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.filestore.v1.Instance) => { - 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.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert.strictEqual( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listInstancesStream with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.filestore.v1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.filestore.v1.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert.strictEqual( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listInstances without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Instance()), - ]; - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.filestore.v1.IInstance[] = []; - const iterable = client.listInstancesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listInstances with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInstancesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.filestore.v1.IInstance[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBackups as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.filestore.v1.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBackups as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listBackups with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - assert((client.innerApiCalls.listBackups as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.filestore.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.filestore.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert.strictEqual( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.filestore.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.filestore.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert.strictEqual( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.filestore.v1.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.filestore.v1.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backup: "backupValue", - }; - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudfilestoremanagerModule.v1.CloudFilestoreManagerClient({ - 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)); - }); - }); - }); -}); 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 5566a34..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: 'CloudFilestoreManager', - filename: './cloud-filestore-manager.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 52876d4..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/filestore', - 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 048fe77..0000000 --- a/owl-bot-staging/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Filestore: 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 ff98186..0000000 --- a/owl-bot-staging/v1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/filestore", - "version": "0.1.0", - "description": "Filestore client for Node.js", - "repository": "googleapis/nodejs-filestore", - "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 filestore", - "filestore", - "cloud filestore manager" - ], - "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/common/operation_metadata.proto b/owl-bot-staging/v1beta1/protos/google/cloud/common/operation_metadata.proto deleted file mode 100644 index 24300e3..0000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/common/operation_metadata.proto +++ /dev/null @@ -1,53 +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.common; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/common;common"; -option java_multiple_files = true; -option java_package = "com.google.cloud.common"; - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // 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. Human-readable status of the operation, if any. - string status_detail = 5 [(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][] of 1, - // corresponding to `Code.CANCELLED`. - bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto b/owl-bot-staging/v1beta1/protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto deleted file mode 100644 index eff8471..0000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto +++ /dev/null @@ -1,766 +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.filestore.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.Filestore.V1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/filestore/v1beta1;filestore"; -option java_multiple_files = true; -option java_outer_classname = "CloudFilestoreServiceProto"; -option java_package = "com.google.cloud.filestore.v1beta1"; -option php_namespace = "Google\\Cloud\\Filestore\\V1beta1"; - -// Configures and manages Cloud Filestore resources. -// -// Cloud Filestore Manager v1beta1. -// -// The `file.googleapis.com` service implements the Cloud Filestore API and -// defines the following model for managing resources: -// * The service works with a collection of cloud projects, named: `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// * Each location has a collection of instances and backups, named: -// `/instances/*` and `/backups/*` respectively. -// * As such, Cloud Filestore instances are resources of the form: -// `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` -// backups are resources of the form: -// `/projects/{project_id}/locations/{location_id}/backup/{backup_id}` -// -// Note that location_id can represent a GCP `zone` or `region` depending on the -// resource. -// for example: -// A zonal Filestore instance: -// * `projects/my-project/locations/us-central1-c/instances/my-basic-tier-filer` -// A regional Filestore instance: -// * `projects/my-project/locations/us-central1/instances/my-enterprise-filer` -service CloudFilestoreManager { - option (google.api.default_host) = "file.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all instances in a project for either a specified location - // or for all locations. - rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/instances" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a specific instance. - rpc GetInstance(GetInstanceRequest) returns (Instance) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates an instance. - // When creating from a backup, the capacity of the new instance needs to be - // equal to or larger than the capacity of the backup (and also equal to or - // larger than the minimum capacity of the tier). - rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*}/instances" - body: "instance" - }; - option (google.api.method_signature) = "parent,instance,instance_id"; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Updates the settings of a specific instance. - rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{instance.name=projects/*/locations/*/instances/*}" - body: "instance" - }; - option (google.api.method_signature) = "instance,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Restores an existing instance's file share from a backup. - // - // The capacity of the instance needs to be equal to or larger than the - // capacity of the backup (and also equal to or larger than the minimum - // capacity of the tier). - rpc RestoreInstance(RestoreInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/instances/*}:restore" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Deletes an instance. - rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Lists all backups in a project for either a specified location or for all - // locations. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a specific backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a backup. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup,backup_id"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Deletes a backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } - - // Updates the settings of a specific backup. - rpc UpdateBackup(UpdateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{backup.name=projects/*/locations/*/backups/*}" - body: "backup" - }; - option (google.api.method_signature) = "backup,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.common.OperationMetadata" - }; - } -} - -// Network configuration for the instance. -message NetworkConfig { - // Internet protocol versions supported by Cloud Filestore. - enum AddressMode { - // Internet protocol not set. - ADDRESS_MODE_UNSPECIFIED = 0; - - // Use the IPv4 internet protocol. - MODE_IPV4 = 1; - } - - // The name of the Google Compute Engine - // [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the - // instance is connected. - string network = 1; - - // Internet protocol versions for which the instance has IP addresses - // assigned. For this version, only MODE_IPV4 is supported. - repeated AddressMode modes = 3; - - // A /29 CIDR block for Basic or a /23 CIDR block for High Scale in one of the - // [internal IP address - // ranges](https://www.arin.net/reference/research/statistics/address_filters/) - // that identifies the range of IP addresses reserved for this instance. For - // example, 10.0.0.0/29 or 192.168.0.0/23. The range you specify can't overlap - // with either existing subnets or assigned IP address ranges for other Cloud - // Filestore instances in the selected VPC network. - string reserved_ip_range = 4; - - // Output only. IPv4 addresses in the format - // `{octet1}.{octet2}.{octet3}.{octet4}` or IPv6 addresses in the format - // `{block1}:{block2}:{block3}:{block4}:{block5}:{block6}:{block7}:{block8}`. - repeated string ip_addresses = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// File share configuration for the instance. -message FileShareConfig { - // The name of the file share (must be 16 characters or less). - string name = 1; - - // File share capacity in gigabytes (GB). - // Cloud Filestore defines 1 GB as 1024^3 bytes. - int64 capacity_gb = 2; - - // The source that this file share has been restored from. Empty if the file - // share is created from scratch. - oneof source { - // The resource name of the backup, in the format - // `projects/{project_id}/locations/{location_id}/backups/{backup_id}`, that - // this file share has been restored from. - string source_backup = 9 [(google.api.resource_reference) = { - type: "file.googleapis.com/Backup" - }]; - } - - // Nfs Export Options. - // There is a limit of 10 export options per file share. - repeated NfsExportOptions nfs_export_options = 8; -} - -// NFS export options specifications. -message NfsExportOptions { - // The access mode. - enum AccessMode { - // AccessMode not set. - ACCESS_MODE_UNSPECIFIED = 0; - - // The client can only read the file share. - READ_ONLY = 1; - - // The client can read and write the file share (default). - READ_WRITE = 2; - } - - // The squash mode. - enum SquashMode { - // SquashMode not set. - SQUASH_MODE_UNSPECIFIED = 0; - - // The Root user has root access to the file share (default). - NO_ROOT_SQUASH = 1; - - // The Root user has squashed access to the anonymous uid/gid. - ROOT_SQUASH = 2; - } - - // List of either an IPv4 addresses in the format - // `{octet1}.{octet2}.{octet3}.{octet4}` or CIDR ranges in the format - // `{octet1}.{octet2}.{octet3}.{octet4}/{mask size}` which may mount the - // file share. - // Overlapping IP ranges are not allowed, both within and across - // NfsExportOptions. An error will be returned. - // The limit is 64 IP ranges/addresses for each FileShareConfig among all - // NfsExportOptions. - repeated string ip_ranges = 1; - - // Either READ_ONLY, for allowing only read requests on the exported - // directory, or READ_WRITE, for allowing both read and write requests. - // The default is READ_WRITE. - AccessMode access_mode = 2; - - // Either NO_ROOT_SQUASH, for allowing root access on the exported directory, - // or ROOT_SQUASH, for not allowing root access. The default is - // NO_ROOT_SQUASH. - SquashMode squash_mode = 3; - - // An integer representing the anonymous user id with a default value of - // 65534. - // Anon_uid may only be set with squash_mode of ROOT_SQUASH. An error will be - // returned if this field is specified for other squash_mode settings. - int64 anon_uid = 4; - - // An integer representing the anonymous group id with a default value of - // 65534. - // Anon_gid may only be set with squash_mode of ROOT_SQUASH. An error will be - // returned if this field is specified for other squash_mode settings. - int64 anon_gid = 5; -} - -// A Cloud Filestore instance. -message Instance { - option (google.api.resource) = { - type: "file.googleapis.com/Instance" - pattern: "projects/{project}/locations/{location}/instances/{instance}" - }; - - // The instance state. - enum State { - // State not set. - STATE_UNSPECIFIED = 0; - - // The instance is being created. - CREATING = 1; - - // The instance is available for use. - READY = 2; - - // Work is being done on the instance. You can get further details from the - // `statusMessage` field of the `Instance` resource. - REPAIRING = 3; - - // The instance is shutting down. - DELETING = 4; - - // The instance is experiencing an issue and might be unusable. You can get - // further details from the `statusMessage` field of the `Instance` - // resource. - ERROR = 6; - - // The instance is restoring a snapshot or backup to an existing file share - // and may be unusable during this time. - RESTORING = 7; - } - - // Available service tiers. - enum Tier { - // Not set. - TIER_UNSPECIFIED = 0; - - // STANDARD tier. BASIC_HDD is the preferred term for this tier. - STANDARD = 1; - - // PREMIUM tier. BASIC_SSD is the preferred term for this tier. - PREMIUM = 2; - - // BASIC instances offer a maximum capacity of 63.9 TB. - // BASIC_HDD is an alias for STANDARD Tier, offering economical - // performance backed by HDD. - BASIC_HDD = 3; - - // BASIC instances offer a maximum capacity of 63.9 TB. - // BASIC_SSD is an alias for PREMIUM Tier, and offers improved - // performance backed by SSD. - BASIC_SSD = 4; - - // HIGH_SCALE instances offer expanded capacity and performance scaling - // capabilities. - HIGH_SCALE_SSD = 6; - } - - // Output only. The resource name of the instance, in the format - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of the instance (2048 characters or less). - string description = 2; - - // Output only. The instance state. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the instance state, if available. - string status_message = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the instance was created. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The service tier of the instance. - Tier tier = 8; - - // Resource labels to represent user provided metadata. - map labels = 9; - - // File system shares on the instance. - // For this version, only a single file share is supported. - repeated FileShareConfig file_shares = 10; - - // VPC networks to which the instance is connected. - // For this version, only a single network is supported. - repeated NetworkConfig networks = 11; - - // Server-specified ETag for the instance resource to prevent simultaneous - // updates from overwriting each other. - string etag = 12; - - // Output only. Reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// CreateInstanceRequest creates an instance. -message CreateInstanceRequest { - // Required. The instance's project and location, in the format - // `projects/{project_id}/locations/{location}`. In Cloud Filestore, - // locations map to GCP zones, for example **us-west1-b**. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The ID of the instance to create. - // The ID must be unique within the specified project and location. - // - // This value must start with a lowercase letter followed by up to 62 - // lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. An [instance resource][google.cloud.filestore.v1beta1.Instance] - Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// GetInstanceRequest gets the state of an instance. -message GetInstanceRequest { - // Required. The instance resource name, in the format - // `projects/{project_id}/locations/{location}/instances/{instance_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "file.googleapis.com/Instance" - } - ]; -} - -// UpdateInstanceRequest updates the settings of an instance. -message UpdateInstanceRequest { - // Required. Mask of fields to update. At least one path must be supplied in this - // field. The elements of the repeated paths field may only include these - // fields: - // - // * "description" - // * "file_shares" - // * "labels" - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only fields specified in update_mask are updated. - Instance instance = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// RestoreInstanceRequest restores an existing instances's file share from a -// snapshot or backup. -message RestoreInstanceRequest { - // Required. The resource name of the instance, in the format - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "file.googleapis.com/Instance" - } - ]; - - // Required. Name of the file share in the Cloud Filestore instance that the snapshot - // is being restored to. - string file_share = 2 [(google.api.field_behavior) = REQUIRED]; - - oneof source { - // The resource name of the snapshot, in the format - // `projects/{project_id}/locations/{location_id}/snapshots/{snapshot_id}`. - string source_snapshot = 3 [(google.api.resource_reference) = { - type: "file.googleapis.com/Snapshot" - }]; - - // The resource name of the backup, in the format - // `projects/{project_id}/locations/{location_id}/backups/{backup_id}`. - string source_backup = 4 [(google.api.resource_reference) = { - type: "file.googleapis.com/Backup" - }]; - } -} - -// DeleteInstanceRequest deletes an instance. -message DeleteInstanceRequest { - // Required. The instance resource name, in the format - // `projects/{project_id}/locations/{location}/instances/{instance_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "file.googleapis.com/Instance" - } - ]; -} - -// ListInstancesRequest lists instances. -message ListInstancesRequest { - // Required. The project and location for which to retrieve instance information, - // in the format `projects/{project_id}/locations/{location}`. In Cloud - // Filestore, locations map to GCP zones, for example **us-west1-b**. To - // retrieve instance information for all locations, use "-" for the - // `{location}` value. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value to use if there are additional - // results to retrieve for this list request. - string page_token = 3; - - // Sort results. Supported values are "name", "name desc" or "" (unsorted). - string order_by = 4; - - // List filter. - string filter = 5; -} - -// ListInstancesResponse is the result of ListInstancesRequest. -message ListInstancesResponse { - // A list of instances in the project for the specified location. - // - // If the `{location}` value in the request is "-", the response contains a - // list of instances from all locations. If any location is unreachable, the - // response will only return instances in reachable locations and the - // "unreachable" field will be populated with a list of unreachable locations. - repeated Instance instances = 1; - - // The token you can use to retrieve the next page of results. Not returned - // if there are no more results in the list. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A Cloud Filestore snapshot. -message Snapshot { - option (google.api.resource) = { - type: "file.googleapis.com/Snapshot" - pattern: "projects/{project}/locations/{location}/instances/{instance}/snapshots/{snapshot}" - }; - - // The snapshot state. - enum State { - // State not set. - STATE_UNSPECIFIED = 0; - - // Snapshot is being created. - CREATING = 1; - - // Snapshot is available for use. - READY = 3; - - // Snapshot is being deleted. - DELETING = 4; - } - - // Output only. The resource name of the snapshot, in the format - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A description of the snapshot with 2048 characters or less. - // Requests with longer descriptions will be rejected. - string description = 2; - - // Output only. The snapshot state. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the snapshot was created. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Resource labels to represent user provided metadata. - map labels = 5; - - // Output only. The amount of bytes needed to allocate a full copy of the snapshot content - int64 filesystem_used_bytes = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A Cloud Filestore backup. -message Backup { - option (google.api.resource) = { - type: "file.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/backups/{backup}" - }; - - // The backup state. - enum State { - // State not set. - STATE_UNSPECIFIED = 0; - - // Backup is being created. - CREATING = 1; - - // Backup has been taken and the operation is being finalized. At this - // point, changes to the file share will not be reflected in the backup. - FINALIZING = 2; - - // Backup is available for use. - READY = 3; - - // Backup is being deleted. - DELETING = 4; - } - - // Output only. The resource name of the backup, in the format - // `projects/{project_id}/locations/{location_id}/backups/{backup_id}`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A description of the backup with 2048 characters or less. - // Requests with longer descriptions will be rejected. - string description = 2; - - // Output only. The backup state. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the backup was created. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Resource labels to represent user provided metadata. - map labels = 5; - - // Output only. Capacity of the source file share when the backup was created. - int64 capacity_gb = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The size of the storage used by the backup. As backups share storage, - // this number is expected to change with backup creation/deletion. - int64 storage_bytes = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The resource name of the source Cloud Filestore instance, in the format - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}`, - // used to create this backup. - string source_instance = 8 [(google.api.resource_reference) = { - type: "file.googleapis.com/Instance" - }]; - - // Name of the file share in the source Cloud Filestore instance that the - // backup is created from. - string source_file_share = 9; - - // Output only. The service tier of the source Cloud Filestore instance that this backup - // is created from. - Instance.Tier source_instance_tier = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Amount of bytes that will be downloaded if the backup is restored - int64 download_bytes = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// CreateBackupRequest creates a backup. -message CreateBackupRequest { - // Required. The backup's project and location, in the format - // `projects/{project_id}/locations/{location}`. In Cloud Filestore, - // backup locations map to GCP regions, for example **us-west1**. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. A [backup resource][google.cloud.filestore.v1beta1.Backup] - Backup backup = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the backup. - // The ID must be unique within the specified project and location. - // - // This value must start with a lowercase letter followed by up to 62 - // lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - string backup_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// DeleteBackupRequest deletes a backup. -message DeleteBackupRequest { - // Required. The backup resource name, in the format - // `projects/{project_id}/locations/{location}/backups/{backup_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "file.googleapis.com/Backup" - } - ]; -} - -// UpdateBackupRequest updates description and/or labels for a backup. -message UpdateBackupRequest { - // Required. A [backup resource][google.cloud.filestore.v1beta1.Backup] - Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Mask of fields to update. At least one path must be supplied in this - // field. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// GetBackupRequest gets the state of a backup. -message GetBackupRequest { - // Required. The backup resource name, in the format - // `projects/{project_id}/locations/{location}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "file.googleapis.com/Backup" - } - ]; -} - -// ListBackupsRequest lists backups. -message ListBackupsRequest { - // Required. The project and location for which to retrieve backup information, - // in the format `projects/{project_id}/locations/{location}`. - // In Cloud Filestore, backup locations map to GCP regions, - // for example **us-west1**. - // To retrieve backup information for all locations, use "-" for the - // `{location}` value. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value to use if there are additional - // results to retrieve for this list request. - string page_token = 3; - - // Sort results. Supported values are "name", "name desc" or "" (unsorted). - string order_by = 4; - - // List filter. - string filter = 5; -} - -// ListBackupsResponse is the result of ListBackupsRequest. -message ListBackupsResponse { - // A list of backups in the project for the specified location. - // - // If the `{location}` value in the request is "-", the response contains a - // list of backups from all locations. If any location is unreachable, the - // response will only return backups in reachable locations and the - // "unreachable" field will be populated with a list of unreachable - // locations. - repeated Backup backups = 1; - - // The token you can use to retrieve the next page of results. Not returned - // if there are no more results in the list. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_backup.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_backup.js deleted file mode 100644 index 8a1d810..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_backup.js +++ /dev/null @@ -1,74 +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, backup, backupId) { - // [START file_v1beta1_generated_CloudFilestoreManager_CreateBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The backup's project and location, in the format - * `projects/{project_id}/locations/{location}`. In Cloud Filestore, - * backup locations map to GCP regions, for example **us-west1**. - */ - // const parent = 'abc123' - /** - * Required. A backup resource google.cloud.filestore.v1beta1.Backup - */ - // const backup = {} - /** - * Required. The ID to use for the backup. - * The ID must be unique within the specified project and location. - * This value must start with a lowercase letter followed by up to 62 - * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - */ - // const backupId = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backup, - backupId, - }; - - // Run request - const [operation] = await filestoreClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END file_v1beta1_generated_CloudFilestoreManager_CreateBackup_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/cloud_filestore_manager.create_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_instance.js deleted file mode 100644 index efd8d80..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.create_instance.js +++ /dev/null @@ -1,74 +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, instanceId, instance) { - // [START file_v1beta1_generated_CloudFilestoreManager_CreateInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The instance's project and location, in the format - * `projects/{project_id}/locations/{location}`. In Cloud Filestore, - * locations map to GCP zones, for example **us-west1-b**. - */ - // const parent = 'abc123' - /** - * Required. The ID of the instance to create. - * The ID must be unique within the specified project and location. - * This value must start with a lowercase letter followed by up to 62 - * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - */ - // const instanceId = 'abc123' - /** - * Required. An instance resource google.cloud.filestore.v1beta1.Instance - */ - // const instance = {} - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callCreateInstance() { - // Construct request - const request = { - parent, - instanceId, - instance, - }; - - // Run request - const [operation] = await filestoreClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateInstance(); - // [END file_v1beta1_generated_CloudFilestoreManager_CreateInstance_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/cloud_filestore_manager.delete_backup.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_backup.js deleted file mode 100644 index 29babc4..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_backup.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 file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The backup resource name, in the format - * `projects/{project_id}/locations/{location}/backups/{backup_id}` - */ - // const name = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await filestoreClient.deleteBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackup(); - // [END file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_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/cloud_filestore_manager.delete_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_instance.js deleted file mode 100644 index 115388b..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.delete_instance.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 file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The instance resource name, in the format - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - */ - // const name = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callDeleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await filestoreClient.deleteInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteInstance(); - // [END file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_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/cloud_filestore_manager.get_backup.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_backup.js deleted file mode 100644 index 6a1ba8d..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_backup.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 file_v1beta1_generated_CloudFilestoreManager_GetBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The backup resource name, in the format - * `projects/{project_id}/locations/{location}/backups/{backup_id}`. - */ - // const name = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await filestoreClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END file_v1beta1_generated_CloudFilestoreManager_GetBackup_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/cloud_filestore_manager.get_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_instance.js deleted file mode 100644 index 5b1b616..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.get_instance.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 file_v1beta1_generated_CloudFilestoreManager_GetInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The instance resource name, in the format - * `projects/{project_id}/locations/{location}/instances/{instance_id}`. - */ - // const name = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callGetInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await filestoreClient.getInstance(request); - console.log(response); - } - - callGetInstance(); - // [END file_v1beta1_generated_CloudFilestoreManager_GetInstance_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/cloud_filestore_manager.list_backups.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_backups.js deleted file mode 100644 index 20b4215..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_backups.js +++ /dev/null @@ -1,82 +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 file_v1beta1_generated_CloudFilestoreManager_ListBackups_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project and location for which to retrieve backup information, - * in the format `projects/{project_id}/locations/{location}`. - * In Cloud Filestore, backup locations map to GCP regions, - * for example **us-west1**. - * To retrieve backup information for all locations, use "-" for the - * `{location}` value. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - */ - // const pageToken = 'abc123' - /** - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - */ - // const orderBy = 'abc123' - /** - * List filter. - */ - // const filter = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await filestoreClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END file_v1beta1_generated_CloudFilestoreManager_ListBackups_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/cloud_filestore_manager.list_instances.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_instances.js deleted file mode 100644 index 550c331..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.list_instances.js +++ /dev/null @@ -1,81 +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 file_v1beta1_generated_CloudFilestoreManager_ListInstances_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project and location for which to retrieve instance information, - * in the format `projects/{project_id}/locations/{location}`. In Cloud - * Filestore, locations map to GCP zones, for example **us-west1-b**. To - * retrieve instance information for all locations, use "-" for the - * `{location}` value. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - */ - // const pageToken = 'abc123' - /** - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - */ - // const orderBy = 'abc123' - /** - * List filter. - */ - // const filter = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callListInstances() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await filestoreClient.listInstancesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListInstances(); - // [END file_v1beta1_generated_CloudFilestoreManager_ListInstances_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/cloud_filestore_manager.restore_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.restore_instance.js deleted file mode 100644 index feac018..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.restore_instance.js +++ /dev/null @@ -1,76 +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, fileShare) { - // [START file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance, in the format - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`. - */ - // const name = 'abc123' - /** - * Required. Name of the file share in the Cloud Filestore instance that the snapshot - * is being restored to. - */ - // const fileShare = 'abc123' - /** - * The resource name of the snapshot, in the format - * `projects/{project_id}/locations/{location_id}/snapshots/{snapshot_id}`. - */ - // const sourceSnapshot = 'abc123' - /** - * The resource name of the backup, in the format - * `projects/{project_id}/locations/{location_id}/backups/{backup_id}`. - */ - // const sourceBackup = 'abc123' - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callRestoreInstance() { - // Construct request - const request = { - name, - fileShare, - }; - - // Run request - const [operation] = await filestoreClient.restoreInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreInstance(); - // [END file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_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/cloud_filestore_manager.update_backup.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_backup.js deleted file mode 100644 index d1c471a..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_backup.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(backup, updateMask) { - // [START file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A backup resource google.cloud.filestore.v1beta1.Backup - */ - // const backup = {} - /** - * Required. Mask of fields to update. At least one path must be supplied in this - * field. - */ - // const updateMask = {} - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callUpdateBackup() { - // Construct request - const request = { - backup, - updateMask, - }; - - // Run request - const [operation] = await filestoreClient.updateBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateBackup(); - // [END file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_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/cloud_filestore_manager.update_instance.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_instance.js deleted file mode 100644 index 176ad3d..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/cloud_filestore_manager.update_instance.js +++ /dev/null @@ -1,69 +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, instance) { - // [START file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_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 these - * fields: - * * "description" - * * "file_shares" - * * "labels" - */ - // const updateMask = {} - /** - * Required. Only fields specified in update_mask are updated. - */ - // const instance = {} - - // Imports the Filestore library - const {CloudFilestoreManagerClient} = require('@google-cloud/filestore').v1beta1; - - // Instantiates a client - const filestoreClient = new CloudFilestoreManagerClient(); - - async function callUpdateInstance() { - // Construct request - const request = { - updateMask, - instance, - }; - - // Run request - const [operation] = await filestoreClient.updateInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateInstance(); - // [END file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_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.filestore.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.filestore.v1beta1.json deleted file mode 100644 index 319df89..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.filestore.v1beta1.json +++ /dev/null @@ -1,523 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-filestore", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.filestore.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_ListInstances_async", - "title": "CloudFilestoreManager listInstances Sample", - "origin": "API_DEFINITION", - "description": " Lists all instances in a project for either a specified location or for all locations.", - "canonical": true, - "file": "cloud_filestore_manager.list_instances.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInstances", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.ListInstances", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.filestore.v1beta1.ListInstancesResponse", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "ListInstances", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.ListInstances", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_GetInstance_async", - "title": "CloudFilestoreManager getInstance Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a specific instance.", - "canonical": true, - "file": "cloud_filestore_manager.get_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.GetInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.filestore.v1beta1.Instance", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "GetInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.GetInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_CreateInstance_async", - "title": "CloudFilestoreManager createInstance Sample", - "origin": "API_DEFINITION", - "description": " Creates an instance. When creating from a backup, the capacity of the new instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).", - "canonical": true, - "file": "cloud_filestore_manager.create_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.CreateInstance", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "instance_id", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": ".google.cloud.filestore.v1beta1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "CreateInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.CreateInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_async", - "title": "CloudFilestoreManager updateInstance Sample", - "origin": "API_DEFINITION", - "description": " Updates the settings of a specific instance.", - "canonical": true, - "file": "cloud_filestore_manager.update_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.UpdateInstance", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "instance", - "type": ".google.cloud.filestore.v1beta1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.UpdateInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_async", - "title": "CloudFilestoreManager restoreInstance Sample", - "origin": "API_DEFINITION", - "description": " Restores an existing instance's file share from a backup. The capacity of the instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).", - "canonical": true, - "file": "cloud_filestore_manager.restore_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.RestoreInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "file_share", - "type": "TYPE_STRING" - }, - { - "name": "source_snapshot", - "type": "TYPE_STRING" - }, - { - "name": "source_backup", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "RestoreInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.RestoreInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_async", - "title": "CloudFilestoreManager deleteInstance Sample", - "origin": "API_DEFINITION", - "description": " Deletes an instance.", - "canonical": true, - "file": "cloud_filestore_manager.delete_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.DeleteInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.DeleteInstance", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_ListBackups_async", - "title": "CloudFilestoreManager listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists all backups in a project for either a specified location or for all locations.", - "canonical": true, - "file": "cloud_filestore_manager.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.filestore.v1beta1.ListBackupsResponse", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.ListBackups", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_GetBackup_async", - "title": "CloudFilestoreManager getBackup Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a specific backup.", - "canonical": true, - "file": "cloud_filestore_manager.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.filestore.v1beta1.Backup", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.GetBackup", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_CreateBackup_async", - "title": "CloudFilestoreManager createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a backup.", - "canonical": true, - "file": "cloud_filestore_manager.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.filestore.v1beta1.Backup" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.CreateBackup", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_async", - "title": "CloudFilestoreManager deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a backup.", - "canonical": true, - "file": "cloud_filestore_manager.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.DeleteBackup", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - }, - { - "regionTag": "file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_async", - "title": "CloudFilestoreManager updateBackup Sample", - "origin": "API_DEFINITION", - "description": " Updates the settings of a specific backup.", - "canonical": true, - "file": "cloud_filestore_manager.update_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.UpdateBackup", - "async": true, - "parameters": [ - { - "name": "backup", - "type": ".google.cloud.filestore.v1beta1.Backup" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFilestoreManagerClient", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManagerClient" - }, - "method": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager.UpdateBackup", - "service": { - "shortName": "CloudFilestoreManager", - "fullName": "google.cloud.filestore.v1beta1.CloudFilestoreManager" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts deleted file mode 100644 index 53ba300..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 CloudFilestoreManagerClient = v1beta1.CloudFilestoreManagerClient; -type CloudFilestoreManagerClient = v1beta1.CloudFilestoreManagerClient; -export {v1beta1, CloudFilestoreManagerClient}; -export default {v1beta1, CloudFilestoreManagerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client.ts deleted file mode 100644 index 04764e2..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client.ts +++ /dev/null @@ -1,1856 +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/cloud_filestore_manager_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_filestore_manager_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Configures and manages Cloud Filestore resources. - * - * Cloud Filestore Manager v1beta1. - * - * The `file.googleapis.com` service implements the Cloud Filestore API and - * defines the following model for managing resources: - * * The service works with a collection of cloud projects, named: `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * * Each location has a collection of instances and backups, named: - * `/instances/*` and `/backups/*` respectively. - * * As such, Cloud Filestore instances are resources of the form: - * `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * backups are resources of the form: - * `/projects/{project_id}/locations/{location_id}/backup/{backup_id}` - * - * Note that location_id can represent a GCP `zone` or `region` depending on the - * resource. - * for example: - * A zonal Filestore instance: - * * `projects/my-project/locations/us-central1-c/instances/my-basic-tier-filer` - * A regional Filestore instance: - * * `projects/my-project/locations/us-central1/instances/my-enterprise-filer` - * @class - * @memberof v1beta1 - */ -export class CloudFilestoreManagerClient { - 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; - cloudFilestoreManagerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudFilestoreManagerClient. - * - * @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 CloudFilestoreManagerClient; - 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 = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backups/{backup}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - snapshotPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}/snapshots/{snapshot}' - ), - }; - - // 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 = { - listInstances: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - 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.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1beta1.Instance') as gax.protobuf.Type; - const createInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const updateInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1beta1.Instance') as gax.protobuf.Type; - const updateInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const restoreInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1beta1.Instance') as gax.protobuf.Type; - const restoreInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const deleteInstanceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1beta1.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const deleteBackupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - const updateBackupResponse = protoFilesRoot.lookup( - '.google.cloud.filestore.v1beta1.Backup') as gax.protobuf.Type; - const updateBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.common.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata)), - updateInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateInstanceResponse.decode.bind(updateInstanceResponse), - updateInstanceMetadata.decode.bind(updateInstanceMetadata)), - restoreInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreInstanceResponse.decode.bind(restoreInstanceResponse), - restoreInstanceMetadata.decode.bind(restoreInstanceMetadata)), - deleteInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInstanceResponse.decode.bind(deleteInstanceResponse), - deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - deleteBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupResponse.decode.bind(deleteBackupResponse), - deleteBackupMetadata.decode.bind(deleteBackupMetadata)), - updateBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateBackupResponse.decode.bind(updateBackupResponse), - updateBackupMetadata.decode.bind(updateBackupMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.filestore.v1beta1.CloudFilestoreManager', 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.cloudFilestoreManagerStub) { - return this.cloudFilestoreManagerStub; - } - - // Put together the "service stub" for - // google.cloud.filestore.v1beta1.CloudFilestoreManager. - this.cloudFilestoreManagerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.filestore.v1beta1.CloudFilestoreManager') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.filestore.v1beta1.CloudFilestoreManager, - 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 cloudFilestoreManagerStubMethods = - ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'restoreInstance', 'deleteInstance', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup', 'updateBackup']; - for (const methodName of cloudFilestoreManagerStubMethods) { - const callPromise = this.cloudFilestoreManagerStub.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.cloudFilestoreManagerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'file.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 'file.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 -- - // ------------------- -/** - * Gets the details of a specific instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The instance resource name, in the format - * `projects/{project_id}/locations/{location}/instances/{instance_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Instance]{@link google.cloud.filestore.v1beta1.Instance}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_filestore_manager.get_instance.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_GetInstance_async - */ - getInstance( - request?: protos.google.cloud.filestore.v1beta1.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.filestore.v1beta1.IInstance, - protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|undefined, {}|undefined - ]>; - getInstance( - request: protos.google.cloud.filestore.v1beta1.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.filestore.v1beta1.IInstance, - protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request: protos.google.cloud.filestore.v1beta1.IGetInstanceRequest, - callback: Callback< - protos.google.cloud.filestore.v1beta1.IInstance, - protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request?: protos.google.cloud.filestore.v1beta1.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.filestore.v1beta1.IInstance, - protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.filestore.v1beta1.IInstance, - protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.filestore.v1beta1.IInstance, - protos.google.cloud.filestore.v1beta1.IGetInstanceRequest|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.getInstance(request, options, callback); - } -/** - * Gets the details of a specific backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The backup resource name, in the format - * `projects/{project_id}/locations/{location}/backups/{backup_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Backup]{@link google.cloud.filestore.v1beta1.Backup}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_filestore_manager.get_backup.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.filestore.v1beta1.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.filestore.v1beta1.IBackup, - protos.google.cloud.filestore.v1beta1.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.cloud.filestore.v1beta1.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.filestore.v1beta1.IBackup, - protos.google.cloud.filestore.v1beta1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.cloud.filestore.v1beta1.IGetBackupRequest, - callback: Callback< - protos.google.cloud.filestore.v1beta1.IBackup, - protos.google.cloud.filestore.v1beta1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.cloud.filestore.v1beta1.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.filestore.v1beta1.IBackup, - protos.google.cloud.filestore.v1beta1.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.filestore.v1beta1.IBackup, - protos.google.cloud.filestore.v1beta1.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.filestore.v1beta1.IBackup, - protos.google.cloud.filestore.v1beta1.IGetBackupRequest|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.getBackup(request, options, callback); - } - -/** - * Creates an instance. - * When creating from a backup, the capacity of the new instance needs to be - * equal to or larger than the capacity of the backup (and also equal to or - * larger than the minimum capacity of the tier). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The instance's project and location, in the format - * `projects/{project_id}/locations/{location}`. In Cloud Filestore, - * locations map to GCP zones, for example **us-west1-b**. - * @param {string} request.instanceId - * Required. The ID of the instance to create. - * The ID must be unique within the specified project and location. - * - * This value must start with a lowercase letter followed by up to 62 - * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - * @param {google.cloud.filestore.v1beta1.Instance} request.instance - * Required. An {@link google.cloud.filestore.v1beta1.Instance|instance 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/cloud_filestore_manager.create_instance.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_CreateInstance_async - */ - createInstance( - request?: protos.google.cloud.filestore.v1beta1.ICreateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createInstance( - request: protos.google.cloud.filestore.v1beta1.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request: protos.google.cloud.filestore.v1beta1.ICreateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request?: protos.google.cloud.filestore.v1beta1.ICreateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - 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.createInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_filestore_manager.create_instance.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_CreateInstance_async - */ - async checkCreateInstanceProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the settings of a specific instance. - * - * @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 these - * fields: - * - * * "description" - * * "file_shares" - * * "labels" - * @param {google.cloud.filestore.v1beta1.Instance} request.instance - * Required. Only 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/cloud_filestore_manager.update_instance.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_async - */ - updateInstance( - request?: protos.google.cloud.filestore.v1beta1.IUpdateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateInstance( - request: protos.google.cloud.filestore.v1beta1.IUpdateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request: protos.google.cloud.filestore.v1beta1.IUpdateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request?: protos.google.cloud.filestore.v1beta1.IUpdateInstanceRequest, - 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({ - 'instance.name': request.instance!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateInstance()`. - * @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/cloud_filestore_manager.update_instance.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_UpdateInstance_async - */ - async checkUpdateInstanceProgress(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.updateInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restores an existing instance's file share from a backup. - * - * The capacity of the instance needs to be equal to or larger than the - * capacity of the backup (and also equal to or larger than the minimum - * capacity of the tier). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the instance, in the format - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}`. - * @param {string} request.fileShare - * Required. Name of the file share in the Cloud Filestore instance that the snapshot - * is being restored to. - * @param {string} request.sourceSnapshot - * The resource name of the snapshot, in the format - * `projects/{project_id}/locations/{location_id}/snapshots/{snapshot_id}`. - * @param {string} request.sourceBackup - * The resource name of the backup, in the format - * `projects/{project_id}/locations/{location_id}/backups/{backup_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * 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/cloud_filestore_manager.restore_instance.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_async - */ - restoreInstance( - request?: protos.google.cloud.filestore.v1beta1.IRestoreInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreInstance( - request: protos.google.cloud.filestore.v1beta1.IRestoreInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreInstance( - request: protos.google.cloud.filestore.v1beta1.IRestoreInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreInstance( - request?: protos.google.cloud.filestore.v1beta1.IRestoreInstanceRequest, - 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.restoreInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreInstance()`. - * @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/cloud_filestore_manager.restore_instance.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_RestoreInstance_async - */ - async checkRestoreInstanceProgress(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.restoreInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The instance resource name, in the format - * `projects/{project_id}/locations/{location}/instances/{instance_id}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * 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/cloud_filestore_manager.delete_instance.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_async - */ - deleteInstance( - request?: protos.google.cloud.filestore.v1beta1.IDeleteInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteInstance( - request: protos.google.cloud.filestore.v1beta1.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request: protos.google.cloud.filestore.v1beta1.IDeleteInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request?: protos.google.cloud.filestore.v1beta1.IDeleteInstanceRequest, - 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.deleteInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteInstance()`. - * @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/cloud_filestore_manager.delete_instance.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_DeleteInstance_async - */ - async checkDeleteInstanceProgress(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.deleteInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The backup's project and location, in the format - * `projects/{project_id}/locations/{location}`. In Cloud Filestore, - * backup locations map to GCP regions, for example **us-west1**. - * @param {google.cloud.filestore.v1beta1.Backup} request.backup - * Required. A {@link google.cloud.filestore.v1beta1.Backup|backup resource} - * @param {string} request.backupId - * Required. The ID to use for the backup. - * The ID must be unique within the specified project and location. - * - * This value must start with a lowercase letter followed by up to 62 - * lowercase letters, numbers, or hyphens, and cannot end with a hyphen. - * @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/cloud_filestore_manager.create_backup.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.filestore.v1beta1.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.cloud.filestore.v1beta1.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.cloud.filestore.v1beta1.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.cloud.filestore.v1beta1.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - 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.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_filestore_manager.create_backup.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBackup, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The backup resource name, in the format - * `projects/{project_id}/locations/{location}/backups/{backup_id}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * 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/cloud_filestore_manager.delete_backup.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.filestore.v1beta1.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.cloud.filestore.v1beta1.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.cloud.filestore.v1beta1.IDeleteBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.cloud.filestore.v1beta1.IDeleteBackupRequest, - 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.deleteBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackup()`. - * @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/cloud_filestore_manager.delete_backup.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_DeleteBackup_async - */ - async checkDeleteBackupProgress(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.deleteBackup, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the settings of a specific backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.filestore.v1beta1.Backup} request.backup - * Required. A {@link google.cloud.filestore.v1beta1.Backup|backup resource} - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in this - * field. - * @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/cloud_filestore_manager.update_backup.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_async - */ - updateBackup( - request?: protos.google.cloud.filestore.v1beta1.IUpdateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateBackup( - request: protos.google.cloud.filestore.v1beta1.IUpdateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBackup( - request: protos.google.cloud.filestore.v1beta1.IUpdateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateBackup( - request?: protos.google.cloud.filestore.v1beta1.IUpdateBackupRequest, - 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({ - 'backup.name': request.backup!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateBackup()`. - * @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/cloud_filestore_manager.update_backup.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_UpdateBackup_async - */ - async checkUpdateBackupProgress(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.updateBackup, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all instances in a project for either a specified location - * or for all locations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location for which to retrieve instance information, - * in the format `projects/{project_id}/locations/{location}`. In Cloud - * Filestore, locations map to GCP zones, for example **us-west1-b**. To - * retrieve instance information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Instance]{@link google.cloud.filestore.v1beta1.Instance}. - * 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 `listInstancesAsync()` - * 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. - */ - listInstances( - request?: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.filestore.v1beta1.IInstance[], - protos.google.cloud.filestore.v1beta1.IListInstancesRequest|null, - protos.google.cloud.filestore.v1beta1.IListInstancesResponse - ]>; - listInstances( - request: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - protos.google.cloud.filestore.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.filestore.v1beta1.IInstance>): void; - listInstances( - request: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - callback: PaginationCallback< - protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - protos.google.cloud.filestore.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.filestore.v1beta1.IInstance>): void; - listInstances( - request?: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - protos.google.cloud.filestore.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.filestore.v1beta1.IInstance>, - callback?: PaginationCallback< - protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - protos.google.cloud.filestore.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.filestore.v1beta1.IInstance>): - Promise<[ - protos.google.cloud.filestore.v1beta1.IInstance[], - protos.google.cloud.filestore.v1beta1.IListInstancesRequest|null, - protos.google.cloud.filestore.v1beta1.IListInstancesResponse - ]>|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.listInstances(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 project and location for which to retrieve instance information, - * in the format `projects/{project_id}/locations/{location}`. In Cloud - * Filestore, locations map to GCP zones, for example **us-west1-b**. To - * retrieve instance information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Instance]{@link google.cloud.filestore.v1beta1.Instance} 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 `listInstancesAsync()` - * 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. - */ - listInstancesStream( - request?: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - 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['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInstances.createStream( - this.innerApiCalls.listInstances as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listInstances`, 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 project and location for which to retrieve instance information, - * in the format `projects/{project_id}/locations/{location}`. In Cloud - * Filestore, locations map to GCP zones, for example **us-west1-b**. To - * retrieve instance information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Instance]{@link google.cloud.filestore.v1beta1.Instance}. 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/cloud_filestore_manager.list_instances.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_ListInstances_async - */ - listInstancesAsync( - request?: protos.google.cloud.filestore.v1beta1.IListInstancesRequest, - 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['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listInstances.asyncIterate( - this.innerApiCalls['listInstances'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists all backups in a project for either a specified location or for all - * locations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location for which to retrieve backup information, - * in the format `projects/{project_id}/locations/{location}`. - * In Cloud Filestore, backup locations map to GCP regions, - * for example **us-west1**. - * To retrieve backup information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Backup]{@link google.cloud.filestore.v1beta1.Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.filestore.v1beta1.IBackup[], - protos.google.cloud.filestore.v1beta1.IListBackupsRequest|null, - protos.google.cloud.filestore.v1beta1.IListBackupsResponse - ]>; - listBackups( - request: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - protos.google.cloud.filestore.v1beta1.IListBackupsResponse|null|undefined, - protos.google.cloud.filestore.v1beta1.IBackup>): void; - listBackups( - request: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - protos.google.cloud.filestore.v1beta1.IListBackupsResponse|null|undefined, - protos.google.cloud.filestore.v1beta1.IBackup>): void; - listBackups( - request?: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - protos.google.cloud.filestore.v1beta1.IListBackupsResponse|null|undefined, - protos.google.cloud.filestore.v1beta1.IBackup>, - callback?: PaginationCallback< - protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - protos.google.cloud.filestore.v1beta1.IListBackupsResponse|null|undefined, - protos.google.cloud.filestore.v1beta1.IBackup>): - Promise<[ - protos.google.cloud.filestore.v1beta1.IBackup[], - protos.google.cloud.filestore.v1beta1.IListBackupsRequest|null, - protos.google.cloud.filestore.v1beta1.IListBackupsResponse - ]>|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.listBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location for which to retrieve backup information, - * in the format `projects/{project_id}/locations/{location}`. - * In Cloud Filestore, backup locations map to GCP regions, - * for example **us-west1**. - * To retrieve backup information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Backup]{@link google.cloud.filestore.v1beta1.Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location for which to retrieve backup information, - * in the format `projects/{project_id}/locations/{location}`. - * In Cloud Filestore, backup locations map to GCP regions, - * for example **us-west1**. - * To retrieve backup information for all locations, use "-" for the - * `{location}` value. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value to use if there are additional - * results to retrieve for this list request. - * @param {string} request.orderBy - * Sort results. Supported values are "name", "name desc" or "" (unsorted). - * @param {string} request.filter - * List filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Backup]{@link google.cloud.filestore.v1beta1.Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_filestore_manager.list_backups.js - * region_tag:file_v1beta1_generated_CloudFilestoreManager_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.filestore.v1beta1.IListBackupsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: 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 snapshot resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @param {string} snapshot - * @returns {string} Resource name string. - */ - snapshotPath(project:string,location:string,instance:string,snapshot:string) { - return this.pathTemplates.snapshotPathTemplate.render({ - project: project, - location: location, - instance: instance, - snapshot: snapshot, - }); - } - - /** - * Parse the project from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project; - } - - /** - * Parse the location from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).location; - } - - /** - * Parse the instance from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).instance; - } - - /** - * Parse the snapshot from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the snapshot. - */ - matchSnapshotFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot; - } - - /** - * 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.cloudFilestoreManagerStub && !this._terminated) { - return this.cloudFilestoreManagerStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client_config.json deleted file mode 100644 index 628a32b..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_client_config.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "interfaces": { - "google.cloud.filestore.v1beta1.CloudFilestoreManager": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "9442ca297df43f7314712e1a19d003838e738a45": { - "initial_retry_delay_millis": 250, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 32000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListInstances": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "GetInstance": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "CreateInstance": { - "timeout_millis": 60000000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateInstance": { - "timeout_millis": 14400000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreInstance": { - "timeout_millis": 60000000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInstance": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "9442ca297df43f7314712e1a19d003838e738a45" - }, - "CreateBackup": { - "timeout_millis": 60000000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBackup": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_proto_list.json deleted file mode 100644 index 848c8cd..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/cloud_filestore_manager_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/common/operation_metadata.proto", - "../../protos/google/cloud/filestore/v1beta1/cloud_filestore_service.proto" -] 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 efd3287..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.filestore.v1beta1", - "libraryPackage": "@google-cloud/filestore", - "services": { - "CloudFilestoreManager": { - "clients": { - "grpc": { - "libraryClient": "CloudFilestoreManagerClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "RestoreInstance": { - "methods": [ - "restoreInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "ListInstances": { - "methods": [ - "listInstances", - "listInstancesStream", - "listInstancesAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CloudFilestoreManagerClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "RestoreInstance": { - "methods": [ - "restoreInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "ListInstances": { - "methods": [ - "listInstances", - "listInstancesStream", - "listInstancesAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - } - } -} 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 1ea2142..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 {CloudFilestoreManagerClient} from './cloud_filestore_manager_client'; 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 987a396..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 filestore = require('@google-cloud/filestore'); - -function main() { - const cloudFilestoreManagerClient = new filestore.CloudFilestoreManagerClient(); -} - -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 d9a17a4..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 {CloudFilestoreManagerClient} from '@google-cloud/filestore'; - -// check that the client class type name can be used -function doStuffWithCloudFilestoreManagerClient(client: CloudFilestoreManagerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudFilestoreManagerClient = new CloudFilestoreManagerClient(); - doStuffWithCloudFilestoreManagerClient(cloudFilestoreManagerClient); -} - -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_cloud_filestore_manager_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_cloud_filestore_manager_v1beta1.ts deleted file mode 100644 index 46871fe..0000000 --- a/owl-bot-staging/v1beta1/test/gapic_cloud_filestore_manager_v1beta1.ts +++ /dev/null @@ -1,2041 +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 cloudfilestoremanagerModule 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.CloudFilestoreManagerClient', () => { - it('has servicePath', () => { - const servicePath = cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudFilestoreManagerStub, undefined); - await client.initialize(); - assert(client.cloudFilestoreManagerStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.cloudFilestoreManagerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudFilestoreManagerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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 cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.cloud.filestore.v1beta1.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getInstance with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - assert((client.innerApiCalls.getInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetInstanceRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.filestore.v1beta1.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getBackup with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - assert((client.innerApiCalls.getBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.GetBackupRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createInstance with call error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInstance(request), expectedError); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createInstance with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateInstance', () => { - it('invokes updateInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInstance( - 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.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateInstance with call error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInstance(request), expectedError); - assert((client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateInstance with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateInstanceProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkUpdateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateInstanceProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkUpdateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreInstance', () => { - it('invokes restoreInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.RestoreInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.RestoreInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreInstance( - 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.restoreInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes restoreInstance with call error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.RestoreInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreInstance(request), expectedError); - assert((client.innerApiCalls.restoreInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreInstance with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.RestoreInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.restoreInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRestoreInstanceProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkRestoreInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreInstanceProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkRestoreInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - 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.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteInstance with call error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInstance(request), expectedError); - assert((client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteInstance with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteInstanceProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkDeleteInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteInstanceProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkDeleteInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createBackup with call error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - 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.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteBackup with call error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - assert((client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBackup with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackup(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteBackupProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkDeleteBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkDeleteBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateBackup', () => { - it('invokes updateBackup without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBackup without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackup( - 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.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateBackup with call error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateBackup(request), expectedError); - assert((client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBackup with LRO error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateBackup(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateBackupProgress without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkUpdateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateBackupProgress with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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.checkUpdateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listInstances', () => { - it('invokes listInstances without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); - const [response] = await client.listInstances(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listInstances as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listInstances without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInstances( - request, - (err?: Error|null, result?: protos.google.cloud.filestore.v1beta1.IInstance[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listInstances as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listInstances with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInstances(request), expectedError); - assert((client.innerApiCalls.listInstances as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listInstancesStream without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - ]; - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.filestore.v1beta1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.filestore.v1beta1.Instance) => { - 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.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert.strictEqual( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listInstancesStream with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.filestore.v1beta1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.filestore.v1beta1.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert.strictEqual( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listInstances without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Instance()), - ]; - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.filestore.v1beta1.IInstance[] = []; - const iterable = client.listInstancesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listInstances with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInstancesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.filestore.v1beta1.IInstance[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBackups as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.filestore.v1beta1.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBackups as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listBackups with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - assert((client.innerApiCalls.listBackups as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.filestore.v1beta1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.filestore.v1beta1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert.strictEqual( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.filestore.v1beta1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.filestore.v1beta1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert.strictEqual( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - generateSampleMessage(new protos.google.cloud.filestore.v1beta1.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.filestore.v1beta1.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.filestore.v1beta1.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.filestore.v1beta1.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backup: "backupValue", - }; - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - 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('snapshot', () => { - const fakePath = "/rendered/path/snapshot"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - snapshot: "snapshotValue", - }; - const client = new cloudfilestoremanagerModule.v1beta1.CloudFilestoreManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.snapshotPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snapshotPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snapshotPath', () => { - const result = client.snapshotPath("projectValue", "locationValue", "instanceValue", "snapshotValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snapshotPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSnapshotName', () => { - const result = client.matchProjectFromSnapshotName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSnapshotName', () => { - const result = client.matchLocationFromSnapshotName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromSnapshotName', () => { - const result = client.matchInstanceFromSnapshotName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSnapshotFromSnapshotName', () => { - const result = client.matchSnapshotFromSnapshotName(fakePath); - assert.strictEqual(result, "snapshotValue"); - assert((client.pathTemplates.snapshotPathTemplate.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 5566a34..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: 'CloudFilestoreManager', - filename: './cloud-filestore-manager.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/cloud_filestore_manager_client.ts b/src/v1/cloud_filestore_manager_client.ts index 63cf537..47d7bf1 100644 --- a/src/v1/cloud_filestore_manager_client.ts +++ b/src/v1/cloud_filestore_manager_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -90,7 +91,7 @@ export class CloudFilestoreManagerClient { * * @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] @@ -113,11 +114,10 @@ export class CloudFilestoreManagerClient { * 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. @@ -213,16 +213,45 @@ export class CloudFilestoreManagerClient { }; 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.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createInstanceResponse = protoFilesRoot.lookup( '.google.cloud.filestore.v1.Instance' diff --git a/src/v1beta1/cloud_filestore_manager_client.ts b/src/v1beta1/cloud_filestore_manager_client.ts index 40da3db..8f78507 100644 --- a/src/v1beta1/cloud_filestore_manager_client.ts +++ b/src/v1beta1/cloud_filestore_manager_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -93,7 +94,7 @@ export class CloudFilestoreManagerClient { * * @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] @@ -116,11 +117,10 @@ export class CloudFilestoreManagerClient { * 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. @@ -219,16 +219,45 @@ export class CloudFilestoreManagerClient { }; 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.longrunning.Operations.CancelOperation', + post: '/v1beta1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1beta1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1beta1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1beta1/{name=projects/*/locations/*}/operations', + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createInstanceResponse = protoFilesRoot.lookup( '.google.cloud.filestore.v1beta1.Instance'