From 09c573ecb246d04b652997a3f976f232e748cf57 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 9 Sep 2022 23:49:01 +0000 Subject: [PATCH 1/4] feat: add default retry configuration feat: add DeleteTransferJob operation feat: add AWS S3 compatible data source PiperOrigin-RevId: 473348271 Source-Link: https://github.com/googleapis/googleapis/commit/56f20492295ddbc1b8c02825fe7a89b7bf530c1c Source-Link: https://github.com/googleapis/googleapis-gen/commit/4f0ba4ff11c129006f76be68465f8e68a4a32814 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGYwYmE0ZmYxMWMxMjkwMDZmNzZiZTY4NDY1ZjhlNjhhNGEzMjgxNCJ9 --- 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 + .../google/storagetransfer/v1/transfer.proto | 387 +++ .../storagetransfer/v1/transfer_types.proto | 1227 ++++++++++ ...et_metadata.google.storagetransfer.v1.json | 631 +++++ ...rage_transfer_service.create_agent_pool.js | 81 + ...ge_transfer_service.create_transfer_job.js | 61 + ...rage_transfer_service.delete_agent_pool.js | 61 + ...ge_transfer_service.delete_transfer_job.js | 67 + ...storage_transfer_service.get_agent_pool.js | 61 + ...sfer_service.get_google_service_account.js | 62 + ...orage_transfer_service.get_transfer_job.js | 67 + ...orage_transfer_service.list_agent_pools.js | 80 + ...age_transfer_service.list_transfer_jobs.js | 81 + ...ansfer_service.pause_transfer_operation.js | 61 + ...nsfer_service.resume_transfer_operation.js | 61 + ...orage_transfer_service.run_transfer_job.js | 68 + ...rage_transfer_service.update_agent_pool.js | 76 + ...ge_transfer_service.update_transfer_job.js | 94 + owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 171 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../src/v1/storage_transfer_service_client.ts | 1916 +++++++++++++++ ...torage_transfer_service_client_config.json | 108 + .../storage_transfer_service_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../test/gapic_storage_transfer_service_v1.ts | 2080 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + 38 files changed, 7955 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/storagetransfer/v1/transfer.proto create mode 100644 owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/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..0ffbf58 --- /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/storage-transfer', + 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..dc9f51c --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Storagetransfer: 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..791c0ac --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/storage-transfer", + "version": "0.1.0", + "description": "Storagetransfer client for Node.js", + "repository": "googleapis/nodejs-storagetransfer", + "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 storagetransfer", + "storagetransfer", + "storage transfer service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.3.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.56", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.0", + "linkinator": "^4.0.2", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.2", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto new file mode 100644 index 0000000..802cc10 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto @@ -0,0 +1,387 @@ +// 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 +// +// 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.storagetransfer.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/storagetransfer/v1/transfer_types.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; +option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; +option java_outer_classname = "TransferProto"; +option java_package = "com.google.storagetransfer.v1.proto"; +option php_namespace = "Google\\Cloud\\StorageTransfer\\V1"; +option ruby_package = "Google::Cloud::StorageTransfer::V1"; + +// Storage Transfer Service and its protos. +// Transfers data between between Google Cloud Storage buckets or from a data +// source external to Google to a Cloud Storage bucket. +service StorageTransferService { + option (google.api.default_host) = "storagetransfer.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns the Google service account that is used by Storage Transfer + // Service to access buckets in the project where transfers + // run or in other projects. Each Google service account is associated + // with one Google Cloud project. Users + // should add this service account to the Google Cloud Storage bucket + // ACLs to grant access to Storage Transfer Service. This service + // account is created and owned by Storage Transfer Service and can + // only be used by Storage Transfer Service. + rpc GetGoogleServiceAccount(GetGoogleServiceAccountRequest) returns (GoogleServiceAccount) { + option (google.api.http) = { + get: "/v1/googleServiceAccounts/{project_id}" + }; + } + + // Creates a transfer job that runs periodically. + rpc CreateTransferJob(CreateTransferJobRequest) returns (TransferJob) { + option (google.api.http) = { + post: "/v1/transferJobs" + body: "transfer_job" + }; + } + + // Updates a transfer job. Updating a job's transfer spec does not affect + // transfer operations that are running already. + // + // **Note:** The job's [status][google.storagetransfer.v1.TransferJob.status] field can be modified + // using this RPC (for example, to set a job's status to + // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED], + // [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], or + // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]). + rpc UpdateTransferJob(UpdateTransferJobRequest) returns (TransferJob) { + option (google.api.http) = { + patch: "/v1/{job_name=transferJobs/**}" + body: "*" + }; + } + + // Gets a transfer job. + rpc GetTransferJob(GetTransferJobRequest) returns (TransferJob) { + option (google.api.http) = { + get: "/v1/{job_name=transferJobs/**}" + }; + } + + // Lists transfer jobs. + rpc ListTransferJobs(ListTransferJobsRequest) returns (ListTransferJobsResponse) { + option (google.api.http) = { + get: "/v1/transferJobs" + }; + } + + // Pauses a transfer operation. + rpc PauseTransferOperation(PauseTransferOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=transferOperations/**}:pause" + body: "*" + }; + } + + // Resumes a transfer operation that is paused. + rpc ResumeTransferOperation(ResumeTransferOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=transferOperations/**}:resume" + body: "*" + }; + } + + // Attempts to start a new TransferOperation for the current TransferJob. A + // TransferJob has a maximum of one active TransferOperation. If this method + // is called while a TransferOperation is active, an error will be returned. + rpc RunTransferJob(RunTransferJobRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{job_name=transferJobs/**}:run" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "TransferOperation" + }; + } + + // Deletes a transfer job. Deleting a transfer job sets its status to + // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. + rpc DeleteTransferJob(DeleteTransferJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{job_name=transferJobs/**}" + }; + } + + // Creates an agent pool resource. + rpc CreateAgentPool(CreateAgentPoolRequest) returns (AgentPool) { + option (google.api.http) = { + post: "/v1/projects/{project_id=*}/agentPools" + body: "agent_pool" + }; + option (google.api.method_signature) = "project_id,agent_pool,agent_pool_id"; + } + + // Updates an existing agent pool resource. + rpc UpdateAgentPool(UpdateAgentPoolRequest) returns (AgentPool) { + option (google.api.http) = { + patch: "/v1/{agent_pool.name=projects/*/agentPools/*}" + body: "agent_pool" + }; + option (google.api.method_signature) = "agent_pool,update_mask"; + } + + // Gets an agent pool. + rpc GetAgentPool(GetAgentPoolRequest) returns (AgentPool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/agentPools/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists agent pools. + rpc ListAgentPools(ListAgentPoolsRequest) returns (ListAgentPoolsResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id=*}/agentPools" + }; + option (google.api.method_signature) = "project_id"; + } + + // Deletes an agent pool. + rpc DeleteAgentPool(DeleteAgentPoolRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/agentPools/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request passed to GetGoogleServiceAccount. +message GetGoogleServiceAccountRequest { + // Required. The ID of the Google Cloud project that the Google service + // account is associated with. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to CreateTransferJob. +message CreateTransferJobRequest { + // Required. The job to create. + TransferJob transfer_job = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to UpdateTransferJob. +message UpdateTransferJobRequest { + // Required. The name of job to update. + string job_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the Google Cloud project that owns the + // job. + string project_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The job to update. `transferJob` is expected to specify one or more of + // five fields: [description][google.storagetransfer.v1.TransferJob.description], + // [transfer_spec][google.storagetransfer.v1.TransferJob.transfer_spec], + // [notification_config][google.storagetransfer.v1.TransferJob.notification_config], + // [logging_config][google.storagetransfer.v1.TransferJob.logging_config], and + // [status][google.storagetransfer.v1.TransferJob.status]. An `UpdateTransferJobRequest` that specifies + // other fields are rejected with the error + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. Updating a job status + // to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED] requires + // `storagetransfer.jobs.delete` permission. + TransferJob transfer_job = 3 [(google.api.field_behavior) = REQUIRED]; + + // The field mask of the fields in `transferJob` that are to be updated in + // this request. Fields in `transferJob` that can be updated are: + // [description][google.storagetransfer.v1.TransferJob.description], + // [transfer_spec][google.storagetransfer.v1.TransferJob.transfer_spec], + // [notification_config][google.storagetransfer.v1.TransferJob.notification_config], + // [logging_config][google.storagetransfer.v1.TransferJob.logging_config], and + // [status][google.storagetransfer.v1.TransferJob.status]. To update the `transfer_spec` of the job, a + // complete transfer specification must be provided. An incomplete + // specification missing any required fields is rejected with the error + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + google.protobuf.FieldMask update_transfer_job_field_mask = 4; +} + +// Request passed to GetTransferJob. +message GetTransferJobRequest { + // Required. The job to get. + string job_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the Google Cloud project that owns the + // job. + string project_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to DeleteTransferJob. +message DeleteTransferJobRequest { + // Required. The job to delete. + string job_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the Google Cloud project that owns the + // job. + string project_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// `projectId`, `jobNames`, and `jobStatuses` are query parameters that can +// be specified when listing transfer jobs. +message ListTransferJobsRequest { + // Required. A list of query parameters specified as JSON text in the form of: + // `{"projectId":"my_project_id", + // "jobNames":["jobid1","jobid2",...], + // "jobStatuses":["status1","status2",...]}` + // + // Since `jobNames` and `jobStatuses` support multiple values, their values + // must be specified with array notation. `projectId` is required. + // `jobNames` and `jobStatuses` are optional. The valid values for + // `jobStatuses` are case-insensitive: + // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED], + // [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], and + // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. + string filter = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list page size. The max allowed value is 256. + int32 page_size = 4; + + // The list page token. + string page_token = 5; +} + +// Response from ListTransferJobs. +message ListTransferJobsResponse { + // A list of transfer jobs. + repeated TransferJob transfer_jobs = 1; + + // The list next page token. + string next_page_token = 2; +} + +// Request passed to PauseTransferOperation. +message PauseTransferOperationRequest { + // Required. The name of the transfer operation. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to ResumeTransferOperation. +message ResumeTransferOperationRequest { + // Required. The name of the transfer operation. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to RunTransferJob. +message RunTransferJobRequest { + // Required. The name of the transfer job. + string job_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the Google Cloud project that owns the transfer + // job. + string project_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies the request passed to CreateAgentPool. +message CreateAgentPoolRequest { + // Required. The ID of the Google Cloud project that owns the + // agent pool. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The agent pool to create. + AgentPool agent_pool = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the agent pool to create. + // + // The `agent_pool_id` must meet the following requirements: + // + // * Length of 128 characters or less. + // * Not start with the string `goog`. + // * Start with a lowercase ASCII character, followed by: + // * Zero or more: lowercase Latin alphabet characters, numerals, + // hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). + // * One or more numerals or lowercase ASCII characters. + // + // As expressed by the regular expression: + // `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`. + string agent_pool_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies the request passed to UpdateAgentPool. +message UpdateAgentPoolRequest { + // Required. The agent pool to update. `agent_pool` is expected to specify following + // fields: + // + // * [name][google.storagetransfer.v1.AgentPool.name] + // + // * [display_name][google.storagetransfer.v1.AgentPool.display_name] + // + // * [bandwidth_limit][google.storagetransfer.v1.AgentPool.bandwidth_limit] + // An `UpdateAgentPoolRequest` with any other fields is rejected + // with the error [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + AgentPool agent_pool = 1 [(google.api.field_behavior) = REQUIRED]; + + // The [field mask] + // (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) + // of the fields in `agentPool` to update in this request. + // The following `agentPool` fields can be updated: + // + // * [display_name][google.storagetransfer.v1.AgentPool.display_name] + // + // * [bandwidth_limit][google.storagetransfer.v1.AgentPool.bandwidth_limit] + google.protobuf.FieldMask update_mask = 2; +} + +// Specifies the request passed to GetAgentPool. +message GetAgentPoolRequest { + // Required. The name of the agent pool to get. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies the request passed to DeleteAgentPool. +message DeleteAgentPoolRequest { + // Required. The name of the agent pool to delete. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request passed to ListAgentPools. +message ListAgentPoolsRequest { + // Required. The ID of the Google Cloud project that owns the job. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // An optional list of query parameters specified as JSON text in the + // form of: + // + // `{"agentPoolNames":["agentpool1","agentpool2",...]}` + // + // Since `agentPoolNames` support multiple values, its values must be + // specified with array notation. When the filter is either empty or not + // provided, the list returns all agent pools for the project. + string filter = 2; + + // The list page size. The max allowed value is `256`. + int32 page_size = 3; + + // The list page token. + string page_token = 4; +} + +// Response from ListAgentPools. +message ListAgentPoolsResponse { + // A list of agent pools. + repeated AgentPool agent_pools = 1; + + // The list next page token. + string next_page_token = 2; +} diff --git a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto new file mode 100644 index 0000000..4e1a3b5 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto @@ -0,0 +1,1227 @@ +// 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 +// +// 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.storagetransfer.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/code.proto"; +import "google/type/date.proto"; +import "google/type/timeofday.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; +option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; +option java_outer_classname = "TransferTypes"; +option java_package = "com.google.storagetransfer.v1.proto"; +option php_namespace = "Google\\Cloud\\StorageTransfer\\V1"; +option ruby_package = "Google::Cloud::StorageTransfer::V1"; + +// Google service account +message GoogleServiceAccount { + // Email address of the service account. + string account_email = 1; + + // Unique identifier for the service account. + string subject_id = 2; +} + +// AWS access key (see +// [AWS Security +// Credentials](https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)). +// +// For information on our data retention policy for user credentials, see +// [User credentials](/storage-transfer/docs/data-retention#user-credentials). +message AwsAccessKey { + // Required. AWS access key ID. + string access_key_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. AWS secret access key. This field is not returned in RPC + // responses. + string secret_access_key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Azure credentials +// +// For information on our data retention policy for user credentials, see +// [User credentials](/storage-transfer/docs/data-retention#user-credentials). +message AzureCredentials { + // Required. Azure shared access signature (SAS). + // + // For more information about SAS, see + // [Grant limited access to Azure Storage resources using shared access + // signatures + // (SAS)](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview). + string sas_token = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Conditions that determine which objects are transferred. Applies only +// to Cloud Data Sources such as S3, Azure, and Cloud Storage. +// +// The "last modification time" refers to the time of the +// last change to the object's content or metadata — specifically, this is +// the `updated` property of Cloud Storage objects, the `LastModified` field +// of S3 objects, and the `Last-Modified` header of Azure blobs. +// +// Transfers with a [PosixFilesystem][google.storagetransfer.v1.PosixFilesystem] source or destination don't support +// `ObjectConditions`. +message ObjectConditions { + // Ensures that objects are not transferred until a specific minimum time + // has elapsed after the "last modification time". When a + // [TransferOperation][google.storagetransfer.v1.TransferOperation] begins, objects with a "last modification time" are + // transferred only if the elapsed time between the + // [start_time][google.storagetransfer.v1.TransferOperation.start_time] of the `TransferOperation` + // and the "last modification time" of the object is equal to or + // greater than the value of min_time_elapsed_since_last_modification`. + // Objects that do not have a "last modification time" are also transferred. + google.protobuf.Duration min_time_elapsed_since_last_modification = 1; + + // Ensures that objects are not transferred if a specific maximum time + // has elapsed since the "last modification time". + // When a [TransferOperation][google.storagetransfer.v1.TransferOperation] begins, objects with a + // "last modification time" are transferred only if the elapsed time + // between the [start_time][google.storagetransfer.v1.TransferOperation.start_time] of the + // `TransferOperation`and the "last modification time" of the object + // is less than the value of max_time_elapsed_since_last_modification`. + // Objects that do not have a "last modification time" are also transferred. + google.protobuf.Duration max_time_elapsed_since_last_modification = 2; + + // If you specify `include_prefixes`, Storage Transfer Service uses the items + // in the `include_prefixes` array to determine which objects to include in a + // transfer. Objects must start with one of the matching `include_prefixes` + // for inclusion in the transfer. If [exclude_prefixes][google.storagetransfer.v1.ObjectConditions.exclude_prefixes] is specified, + // objects must not start with any of the `exclude_prefixes` specified for + // inclusion in the transfer. + // + // The following are requirements of `include_prefixes`: + // + // * Each include-prefix can contain any sequence of Unicode characters, to + // a max length of 1024 bytes when UTF8-encoded, and must not contain + // Carriage Return or Line Feed characters. Wildcard matching and regular + // expression matching are not supported. + // + // * Each include-prefix must omit the leading slash. For example, to + // include the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, + // specify the include-prefix as `logs/y=2015/requests.gz`. + // + // * None of the include-prefix values can be empty, if specified. + // + // * Each include-prefix must include a distinct portion of the object + // namespace. No include-prefix may be a prefix of another + // include-prefix. + // + // The max size of `include_prefixes` is 1000. + // + // For more information, see [Filtering objects from + // transfers](/storage-transfer/docs/filtering-objects-from-transfers). + repeated string include_prefixes = 3; + + // If you specify `exclude_prefixes`, Storage Transfer Service uses the items + // in the `exclude_prefixes` array to determine which objects to exclude from + // a transfer. Objects must not start with one of the matching + // `exclude_prefixes` for inclusion in a transfer. + // + // The following are requirements of `exclude_prefixes`: + // + // * Each exclude-prefix can contain any sequence of Unicode characters, to + // a max length of 1024 bytes when UTF8-encoded, and must not contain + // Carriage Return or Line Feed characters. Wildcard matching and regular + // expression matching are not supported. + // + // * Each exclude-prefix must omit the leading slash. For example, to + // exclude the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, + // specify the exclude-prefix as `logs/y=2015/requests.gz`. + // + // * None of the exclude-prefix values can be empty, if specified. + // + // * Each exclude-prefix must exclude a distinct portion of the object + // namespace. No exclude-prefix may be a prefix of another + // exclude-prefix. + // + // * If [include_prefixes][google.storagetransfer.v1.ObjectConditions.include_prefixes] is specified, then each exclude-prefix must + // start with the value of a path explicitly included by `include_prefixes`. + // + // The max size of `exclude_prefixes` is 1000. + // + // For more information, see [Filtering objects from + // transfers](/storage-transfer/docs/filtering-objects-from-transfers). + repeated string exclude_prefixes = 4; + + // If specified, only objects with a "last modification time" on or after + // this timestamp and objects that don't have a "last modification time" are + // transferred. + // + // The `last_modified_since` and `last_modified_before` fields can be used + // together for chunked data processing. For example, consider a script that + // processes each day's worth of data at a time. For that you'd set each + // of the fields as follows: + // + // * `last_modified_since` to the start of the day + // + // * `last_modified_before` to the end of the day + google.protobuf.Timestamp last_modified_since = 5; + + // If specified, only objects with a "last modification time" before this + // timestamp and objects that don't have a "last modification time" are + // transferred. + google.protobuf.Timestamp last_modified_before = 6; +} + +// In a GcsData resource, an object's name is the Cloud Storage object's +// name and its "last modification time" refers to the object's `updated` +// property of Cloud Storage objects, which changes when the content or the +// metadata of the object is updated. +message GcsData { + // Required. Cloud Storage bucket name. Must meet + // [Bucket Name Requirements](/storage/docs/naming#requirements). + string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Root path to transfer objects. + // + // Must be an empty string or full path name that ends with a '/'. This field + // is treated as an object prefix. As such, it should generally not begin with + // a '/'. + // + // The root path value must meet + // [Object Name Requirements](/storage/docs/naming#objectnames). + string path = 3; +} + +// An AwsS3Data resource can be a data source, but not a data sink. +// In an AwsS3Data resource, an object's name is the S3 object's key name. +message AwsS3Data { + // Required. S3 Bucket name (see + // [Creating a + // bucket](https://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-get-location-example.html)). + string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Input only. AWS access key used to sign the API requests to the AWS S3 bucket. + // Permissions on the bucket must be granted to the access ID of the AWS + // access key. + // + // For information on our data retention policy for user credentials, see + // [User credentials](/storage-transfer/docs/data-retention#user-credentials). + AwsAccessKey aws_access_key = 2 [(google.api.field_behavior) = INPUT_ONLY]; + + // Root path to transfer objects. + // + // Must be an empty string or full path name that ends with a '/'. This field + // is treated as an object prefix. As such, it should generally not begin with + // a '/'. + string path = 3; + + // The Amazon Resource Name (ARN) of the role to support temporary + // credentials via `AssumeRoleWithWebIdentity`. For more information about + // ARNs, see [IAM + // ARNs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns). + // + // When a role ARN is provided, Transfer Service fetches temporary + // credentials for the session using a `AssumeRoleWithWebIdentity` call for + // the provided role using the [GoogleServiceAccount][google.storagetransfer.v1.GoogleServiceAccount] for this project. + string role_arn = 4; +} + +// An AzureBlobStorageData resource can be a data source, but not a data sink. +// An AzureBlobStorageData resource represents one Azure container. The storage +// account determines the [Azure +// endpoint](https://docs.microsoft.com/en-us/azure/storage/common/storage-create-storage-account#storage-account-endpoints). +// In an AzureBlobStorageData resource, a blobs's name is the [Azure Blob +// Storage blob's key +// name](https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#blob-names). +message AzureBlobStorageData { + // Required. The name of the Azure Storage account. + string storage_account = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. Credentials used to authenticate API requests to Azure. + // + // For information on our data retention policy for user credentials, see + // [User credentials](/storage-transfer/docs/data-retention#user-credentials). + AzureCredentials azure_credentials = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // Required. The container to transfer from the Azure Storage account. + string container = 4 [(google.api.field_behavior) = REQUIRED]; + + // Root path to transfer objects. + // + // Must be an empty string or full path name that ends with a '/'. This field + // is treated as an object prefix. As such, it should generally not begin with + // a '/'. + string path = 5; +} + +// An HttpData resource specifies a list of objects on the web to be transferred +// over HTTP. The information of the objects to be transferred is contained in +// a file referenced by a URL. The first line in the file must be +// `"TsvHttpData-1.0"`, which specifies the format of the file. Subsequent +// lines specify the information of the list of objects, one object per list +// entry. Each entry has the following tab-delimited fields: +// +// * **HTTP URL** — The location of the object. +// +// * **Length** — The size of the object in bytes. +// +// * **MD5** — The base64-encoded MD5 hash of the object. +// +// For an example of a valid TSV file, see +// [Transferring data from +// URLs](https://cloud.google.com/storage-transfer/docs/create-url-list). +// +// When transferring data based on a URL list, keep the following in mind: +// +// * When an object located at `http(s)://hostname:port/` is +// transferred to a data sink, the name of the object at the data sink is +// `/`. +// +// * If the specified size of an object does not match the actual size of the +// object fetched, the object is not transferred. +// +// * If the specified MD5 does not match the MD5 computed from the transferred +// bytes, the object transfer fails. +// +// * Ensure that each URL you specify is publicly accessible. For +// example, in Cloud Storage you can +// [share an object publicly] +// (/storage/docs/cloud-console#_sharingdata) and get a link to it. +// +// * Storage Transfer Service obeys `robots.txt` rules and requires the source +// HTTP server to support `Range` requests and to return a `Content-Length` +// header in each response. +// +// * [ObjectConditions][google.storagetransfer.v1.ObjectConditions] have no effect when filtering objects to transfer. +message HttpData { + // Required. The URL that points to the file that stores the object list + // entries. This file must allow public access. Currently, only URLs with + // HTTP and HTTPS schemes are supported. + string list_url = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A POSIX filesystem resource. +message PosixFilesystem { + // Root directory path to the filesystem. + string root_directory = 1; +} + +// An AwsS3CompatibleData resource. +message AwsS3CompatibleData { + // Required. Specifies the name of the bucket. + string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the root path to transfer objects. + // + // Must be an empty string or full path name that ends with a '/'. This + // field is treated as an object prefix. As such, it should generally not + // begin with a '/'. + string path = 2; + + // Required. Specifies the endpoint of the storage service. + string endpoint = 3 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the region to sign requests with. This can be left blank if + // requests should be signed with an empty region. + string region = 5; + + // Specifies the metadata of the S3 compatible data provider. Each provider + // may contain some attributes that do not apply to all S3-compatible data + // providers. When not specified, S3CompatibleMetadata is used by default. + oneof data_provider { + // A S3 compatible metadata. + S3CompatibleMetadata s3_metadata = 4; + } +} + +// S3CompatibleMetadata contains the metadata fields that apply to the basic +// types of S3-compatible data providers. +message S3CompatibleMetadata { + // The authentication and authorization method used by the storage service. + enum AuthMethod { + // AuthMethod is not specified. + AUTH_METHOD_UNSPECIFIED = 0; + + // Auth requests with AWS SigV4. + AUTH_METHOD_AWS_SIGNATURE_V4 = 1; + + // Auth requests with AWS SigV2. + AUTH_METHOD_AWS_SIGNATURE_V2 = 2; + } + + // The request model of the API. + enum RequestModel { + // RequestModel is not specified. + REQUEST_MODEL_UNSPECIFIED = 0; + + // Perform requests using Virtual Hosted Style. + // Example: https://bucket-name.s3.region.amazonaws.com/key-name + REQUEST_MODEL_VIRTUAL_HOSTED_STYLE = 1; + + // Perform requests using Path Style. + // Example: https://s3.region.amazonaws.com/bucket-name/key-name + REQUEST_MODEL_PATH_STYLE = 2; + } + + // The agent network protocol to access the storage service. + enum NetworkProtocol { + // NetworkProtocol is not specified. + NETWORK_PROTOCOL_UNSPECIFIED = 0; + + // Perform requests using HTTPS. + NETWORK_PROTOCOL_HTTPS = 1; + + // Not recommended: This sends data in clear-text. This is only + // appropriate within a closed network or for publicly available data. + // Perform requests using HTTP. + NETWORK_PROTOCOL_HTTP = 2; + } + + // The Listing API to use for discovering objects. + enum ListApi { + // ListApi is not specified. + LIST_API_UNSPECIFIED = 0; + + // Perform listing using ListObjectsV2 API. + LIST_OBJECTS_V2 = 1; + + // Legacy ListObjects API. + LIST_OBJECTS = 2; + } + + // Specifies the authentication and authorization method used by the storage + // service. When not specified, Transfer Service will attempt to determine + // right auth method to use. + AuthMethod auth_method = 1; + + // Specifies the API request model used to call the storage service. When not + // specified, the default value of RequestModel + // REQUEST_MODEL_VIRTUAL_HOSTED_STYLE is used. + RequestModel request_model = 2; + + // Specifies the network protocol of the agent. When not specified, the + // default value of NetworkProtocol NETWORK_PROTOCOL_HTTPS is used. + NetworkProtocol protocol = 3; + + // The Listing API to use for discovering objects. When not specified, + // Transfer Service will attempt to determine the right API to use. + ListApi list_api = 4; +} + +// Represents an On-Premises Agent pool. +message AgentPool { + option (google.api.resource) = { + type: "storagetransfer.googleapis.com/agentPools" + pattern: "projects/{project_id}/agentPools/{agent_pool_id}" + }; + + // The state of an AgentPool. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // This is an initialization state. During this stage, the resources such as + // Pub/Sub topics are allocated for the AgentPool. + CREATING = 1; + + // Determines that the AgentPool is created for use. At this state, Agents + // can join the AgentPool and participate in the transfer jobs in that pool. + CREATED = 2; + + // Determines that the AgentPool deletion has been initiated, and all the + // resources are scheduled to be cleaned up and freed. + DELETING = 3; + } + + // Specifies a bandwidth limit for an agent pool. + message BandwidthLimit { + // Bandwidth rate in megabytes per second, distributed across all the agents + // in the pool. + int64 limit_mbps = 1; + } + + // Required. Specifies a unique string that identifies the agent pool. + // + // Format: `projects/{project_id}/agentPools/{agent_pool_id}` + string name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the client-specified AgentPool description. + string display_name = 3; + + // Output only. Specifies the state of the AgentPool. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Specifies the bandwidth limit details. If this field is unspecified, the + // default value is set as 'No Limit'. + BandwidthLimit bandwidth_limit = 5; +} + +// TransferOptions define the actions to be performed on objects in a transfer. +message TransferOptions { + // Specifies when to overwrite an object in the sink when an object with + // matching name is found in the source. + enum OverwriteWhen { + // Overwrite behavior is unspecified. + OVERWRITE_WHEN_UNSPECIFIED = 0; + + // Overwrites destination objects with the source objects, only if the + // objects have the same name but different HTTP ETags or checksum values. + DIFFERENT = 1; + + // Never overwrites a destination object if a source object has the + // same name. In this case, the source object is not transferred. + NEVER = 2; + + // Always overwrite the destination object with the source object, even if + // the HTTP Etags or checksum values are the same. + ALWAYS = 3; + } + + // When to overwrite objects that already exist in the sink. The default is + // that only objects that are different from the source are ovewritten. If + // true, all objects in the sink whose name matches an object in the source + // are overwritten with the source object. + bool overwrite_objects_already_existing_in_sink = 1; + + // Whether objects that exist only in the sink should be deleted. + // + // **Note:** This option and [delete_objects_from_source_after_transfer][google.storagetransfer.v1.TransferOptions.delete_objects_from_source_after_transfer] are + // mutually exclusive. + bool delete_objects_unique_in_sink = 2; + + // Whether objects should be deleted from the source after they are + // transferred to the sink. + // + // **Note:** This option and [delete_objects_unique_in_sink][google.storagetransfer.v1.TransferOptions.delete_objects_unique_in_sink] are mutually + // exclusive. + bool delete_objects_from_source_after_transfer = 3; + + // When to overwrite objects that already exist in the sink. If not set, + // overwrite behavior is determined by + // [overwrite_objects_already_existing_in_sink][google.storagetransfer.v1.TransferOptions.overwrite_objects_already_existing_in_sink]. + OverwriteWhen overwrite_when = 4; + + // Represents the selected metadata options for a transfer job. + MetadataOptions metadata_options = 5; +} + +// Configuration for running a transfer. +message TransferSpec { + // The write sink for the data. + oneof data_sink { + // A Cloud Storage data sink. + GcsData gcs_data_sink = 4; + + // A POSIX Filesystem data sink. + PosixFilesystem posix_data_sink = 13; + } + + // The read source of the data. + oneof data_source { + // A Cloud Storage data source. + GcsData gcs_data_source = 1; + + // An AWS S3 data source. + AwsS3Data aws_s3_data_source = 2; + + // An HTTP URL data source. + HttpData http_data_source = 3; + + // A POSIX Filesystem data source. + PosixFilesystem posix_data_source = 14; + + // An Azure Blob Storage data source. + AzureBlobStorageData azure_blob_storage_data_source = 8; + + // An AWS S3 compatible data source. + AwsS3CompatibleData aws_s3_compatible_data_source = 19; + } + + // Represents a supported data container type which is required for transfer + // jobs which needs a data source, a data sink and an intermediate location to + // transfer data through. This is validated on TransferJob creation. + oneof intermediate_data_location { + // Cloud Storage intermediate data location. + GcsData gcs_intermediate_data_location = 16; + } + + // Only objects that satisfy these object conditions are included in the set + // of data source and data sink objects. Object conditions based on + // objects' "last modification time" do not exclude objects in a data sink. + ObjectConditions object_conditions = 5; + + // If the option + // [delete_objects_unique_in_sink][google.storagetransfer.v1.TransferOptions.delete_objects_unique_in_sink] + // is `true` and time-based object conditions such as 'last modification time' + // are specified, the request fails with an + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. + TransferOptions transfer_options = 6; + + // A manifest file provides a list of objects to be transferred from the data + // source. This field points to the location of the manifest file. + // Otherwise, the entire source bucket is used. ObjectConditions still apply. + TransferManifest transfer_manifest = 15; + + // Specifies the agent pool name associated with the posix data source. When + // unspecified, the default name is used. + string source_agent_pool_name = 17; + + // Specifies the agent pool name associated with the posix data sink. When + // unspecified, the default name is used. + string sink_agent_pool_name = 18; +} + +// Specifies the metadata options for running a transfer. +message MetadataOptions { + // Whether symlinks should be skipped or preserved during a transfer job. + enum Symlink { + // Symlink behavior is unspecified. + SYMLINK_UNSPECIFIED = 0; + + // Do not preserve symlinks during a transfer job. + SYMLINK_SKIP = 1; + + // Preserve symlinks during a transfer job. + SYMLINK_PRESERVE = 2; + } + + // Options for handling file mode attribute. + enum Mode { + // Mode behavior is unspecified. + MODE_UNSPECIFIED = 0; + + // Do not preserve mode during a transfer job. + MODE_SKIP = 1; + + // Preserve mode during a transfer job. + MODE_PRESERVE = 2; + } + + // Options for handling file GID attribute. + enum GID { + // GID behavior is unspecified. + GID_UNSPECIFIED = 0; + + // Do not preserve GID during a transfer job. + GID_SKIP = 1; + + // Preserve GID during a transfer job. + GID_NUMBER = 2; + } + + // Options for handling file UID attribute. + enum UID { + // UID behavior is unspecified. + UID_UNSPECIFIED = 0; + + // Do not preserve UID during a transfer job. + UID_SKIP = 1; + + // Preserve UID during a transfer job. + UID_NUMBER = 2; + } + + // Options for handling Cloud Storage object ACLs. + enum Acl { + // ACL behavior is unspecified. + ACL_UNSPECIFIED = 0; + + // Use the destination bucket's default object ACLS, if applicable. + ACL_DESTINATION_BUCKET_DEFAULT = 1; + + // Preserve the object's original ACLs. This requires the service account + // to have `storage.objects.getIamPolicy` permission for the source object. + // [Uniform bucket-level + // access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) + // must not be enabled on either the source or destination buckets. + ACL_PRESERVE = 2; + } + + // Options for handling Google Cloud Storage object storage class. + enum StorageClass { + // Storage class behavior is unspecified. + STORAGE_CLASS_UNSPECIFIED = 0; + + // Use the destination bucket's default storage class. + STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT = 1; + + // Preserve the object's original storage class. This is only supported for + // transfers from Google Cloud Storage buckets. + STORAGE_CLASS_PRESERVE = 2; + + // Set the storage class to STANDARD. + STORAGE_CLASS_STANDARD = 3; + + // Set the storage class to NEARLINE. + STORAGE_CLASS_NEARLINE = 4; + + // Set the storage class to COLDLINE. + STORAGE_CLASS_COLDLINE = 5; + + // Set the storage class to ARCHIVE. + STORAGE_CLASS_ARCHIVE = 6; + } + + // Options for handling temporary holds for Google Cloud Storage objects. + enum TemporaryHold { + // Temporary hold behavior is unspecified. + TEMPORARY_HOLD_UNSPECIFIED = 0; + + // Do not set a temporary hold on the destination object. + TEMPORARY_HOLD_SKIP = 1; + + // Preserve the object's original temporary hold status. + TEMPORARY_HOLD_PRESERVE = 2; + } + + // Options for handling the KmsKey setting for Google Cloud Storage objects. + enum KmsKey { + // KmsKey behavior is unspecified. + KMS_KEY_UNSPECIFIED = 0; + + // Use the destination bucket's default encryption settings. + KMS_KEY_DESTINATION_BUCKET_DEFAULT = 1; + + // Preserve the object's original Cloud KMS customer-managed encryption key + // (CMEK) if present. Objects that do not use a Cloud KMS encryption key + // will be encrypted using the destination bucket's encryption settings. + KMS_KEY_PRESERVE = 2; + } + + // Options for handling `timeCreated` metadata for Google Cloud Storage + // objects. + enum TimeCreated { + // TimeCreated behavior is unspecified. + TIME_CREATED_UNSPECIFIED = 0; + + // Do not preserve the `timeCreated` metadata from the source object. + TIME_CREATED_SKIP = 1; + + // Preserves the source object's `timeCreated` metadata in the `customTime` + // field in the destination object. Note that any value stored in the + // source object's `customTime` field will not be propagated to the + // destination object. + TIME_CREATED_PRESERVE_AS_CUSTOM_TIME = 2; + } + + // Specifies how symlinks should be handled by the transfer. By default, + // symlinks are not preserved. Only applicable to transfers involving + // POSIX file systems, and ignored for other transfers. + Symlink symlink = 1; + + // Specifies how each file's mode attribute should be handled by the transfer. + // By default, mode is not preserved. Only applicable to transfers involving + // POSIX file systems, and ignored for other transfers. + Mode mode = 2; + + // Specifies how each file's POSIX group ID (GID) attribute should be handled + // by the transfer. By default, GID is not preserved. Only applicable to + // transfers involving POSIX file systems, and ignored for other transfers. + GID gid = 3; + + // Specifies how each file's POSIX user ID (UID) attribute should be handled + // by the transfer. By default, UID is not preserved. Only applicable to + // transfers involving POSIX file systems, and ignored for other transfers. + UID uid = 4; + + // Specifies how each object's ACLs should be preserved for transfers between + // Google Cloud Storage buckets. If unspecified, the default behavior is the + // same as ACL_DESTINATION_BUCKET_DEFAULT. + Acl acl = 5; + + // Specifies the storage class to set on objects being transferred to Google + // Cloud Storage buckets. If unspecified, the default behavior is the same as + // [STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT][google.storagetransfer.v1.MetadataOptions.StorageClass.STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT]. + StorageClass storage_class = 6; + + // Specifies how each object's temporary hold status should be preserved for + // transfers between Google Cloud Storage buckets. If unspecified, the + // default behavior is the same as + // [TEMPORARY_HOLD_PRESERVE][google.storagetransfer.v1.MetadataOptions.TemporaryHold.TEMPORARY_HOLD_PRESERVE]. + TemporaryHold temporary_hold = 7; + + // Specifies how each object's Cloud KMS customer-managed encryption key + // (CMEK) is preserved for transfers between Google Cloud Storage buckets. If + // unspecified, the default behavior is the same as + // [KMS_KEY_DESTINATION_BUCKET_DEFAULT][google.storagetransfer.v1.MetadataOptions.KmsKey.KMS_KEY_DESTINATION_BUCKET_DEFAULT]. + KmsKey kms_key = 8; + + // Specifies how each object's `timeCreated` metadata is preserved for + // transfers between Google Cloud Storage buckets. If unspecified, the + // default behavior is the same as + // [TIME_CREATED_SKIP][google.storagetransfer.v1.MetadataOptions.TimeCreated.TIME_CREATED_SKIP]. + TimeCreated time_created = 9; +} + +// Specifies where the manifest is located. +message TransferManifest { + // Specifies the path to the manifest in Cloud Storage. The Google-managed + // service account for the transfer must have `storage.objects.get` + // permission for this object. An example path is + // `gs://bucket_name/path/manifest.csv`. + string location = 1; +} + +// Transfers can be scheduled to recur or to run just once. +message Schedule { + // Required. The start date of a transfer. Date boundaries are determined + // relative to UTC time. If `schedule_start_date` and [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day] + // are in the past relative to the job's creation time, the transfer starts + // the day after you schedule the transfer request. + // + // **Note:** When starting jobs at or near midnight UTC it is possible that + // a job starts later than expected. For example, if you send an outbound + // request on June 1 one millisecond prior to midnight UTC and the Storage + // Transfer Service server receives the request on June 2, then it creates + // a TransferJob with `schedule_start_date` set to June 2 and a + // `start_time_of_day` set to midnight UTC. The first scheduled + // [TransferOperation][google.storagetransfer.v1.TransferOperation] takes place on June 3 at midnight UTC. + google.type.Date schedule_start_date = 1 [(google.api.field_behavior) = REQUIRED]; + + // The last day a transfer runs. Date boundaries are determined relative to + // UTC time. A job runs once per 24 hours within the following guidelines: + // + // * If `schedule_end_date` and [schedule_start_date][google.storagetransfer.v1.Schedule.schedule_start_date] are the same and in + // the future relative to UTC, the transfer is executed only one time. + // * If `schedule_end_date` is later than `schedule_start_date` and + // `schedule_end_date` is in the future relative to UTC, the job runs each + // day at [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day] through `schedule_end_date`. + google.type.Date schedule_end_date = 2; + + // The time in UTC that a transfer job is scheduled to run. Transfers may + // start later than this time. + // + // If `start_time_of_day` is not specified: + // + // * One-time transfers run immediately. + // * Recurring transfers run immediately, and each day at midnight UTC, + // through [schedule_end_date][google.storagetransfer.v1.Schedule.schedule_end_date]. + // + // If `start_time_of_day` is specified: + // + // * One-time transfers run at the specified time. + // * Recurring transfers run at the specified time each day, through + // `schedule_end_date`. + google.type.TimeOfDay start_time_of_day = 3; + + // The time in UTC that no further transfer operations are scheduled. Combined + // with [schedule_end_date][google.storagetransfer.v1.Schedule.schedule_end_date], `end_time_of_day` specifies the end date and + // time for starting new transfer operations. This field must be greater than + // or equal to the timestamp corresponding to the combintation of + // [schedule_start_date][google.storagetransfer.v1.Schedule.schedule_start_date] and [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day], and is subject to the + // following: + // + // * If `end_time_of_day` is not set and `schedule_end_date` is set, then + // a default value of `23:59:59` is used for `end_time_of_day`. + // + // * If `end_time_of_day` is set and `schedule_end_date` is not set, then + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] is returned. + google.type.TimeOfDay end_time_of_day = 4; + + // Interval between the start of each scheduled TransferOperation. If + // unspecified, the default value is 24 hours. This value may not be less than + // 1 hour. + google.protobuf.Duration repeat_interval = 5; +} + +// This resource represents the configuration of a transfer job that runs +// periodically. +message TransferJob { + // The status of the transfer job. + enum Status { + // Zero is an illegal value. + STATUS_UNSPECIFIED = 0; + + // New transfers are performed based on the schedule. + ENABLED = 1; + + // New transfers are not scheduled. + DISABLED = 2; + + // This is a soft delete state. After a transfer job is set to this + // state, the job and all the transfer executions are subject to + // garbage collection. Transfer jobs become eligible for garbage collection + // 30 days after their status is set to `DELETED`. + DELETED = 3; + } + + // A unique name (within the transfer project) assigned when the job is + // created. If this field is empty in a CreateTransferJobRequest, Storage + // Transfer Service assigns a unique name. Otherwise, the specified name + // is used as the unique name for this job. + // + // If the specified name is in use by a job, the creation request fails with + // an [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. + // + // This name must start with `"transferJobs/"` prefix and end with a letter or + // a number, and should be no more than 128 characters. For transfers + // involving PosixFilesystem, this name must start with `transferJobs/OPI` + // specifically. For all other transfer types, this name must not start with + // `transferJobs/OPI`. + // + // Non-PosixFilesystem example: + // `"transferJobs/^(?!OPI)[A-Za-z0-9-._~]*[A-Za-z0-9]$"` + // + // PosixFilesystem example: + // `"transferJobs/OPI^[A-Za-z0-9-._~]*[A-Za-z0-9]$"` + // + // Applications must not rely on the enforcement of naming requirements + // involving OPI. + // + // Invalid job names fail with an + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. + string name = 1; + + // A description provided by the user for the job. Its max length is 1024 + // bytes when Unicode-encoded. + string description = 2; + + // The ID of the Google Cloud project that owns the job. + string project_id = 3; + + // Transfer specification. + TransferSpec transfer_spec = 4; + + // Notification configuration. This is not supported for transfers involving + // PosixFilesystem. + NotificationConfig notification_config = 11; + + // Logging configuration. + LoggingConfig logging_config = 14; + + // Specifies schedule for the transfer job. + // This is an optional field. When the field is not set, the job never + // executes a transfer, unless you invoke RunTransferJob or update the job to + // have a non-empty schedule. + Schedule schedule = 5; + + // Status of the job. This value MUST be specified for + // `CreateTransferJobRequests`. + // + // **Note:** The effect of the new job status takes place during a subsequent + // job run. For example, if you change the job status from + // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED] to [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], and an operation + // spawned by the transfer is running, the status change would not affect the + // current operation. + Status status = 6; + + // Output only. The time that the transfer job was created. + google.protobuf.Timestamp creation_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time that the transfer job was last modified. + google.protobuf.Timestamp last_modification_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time that the transfer job was deleted. + google.protobuf.Timestamp deletion_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the most recently started TransferOperation of this JobConfig. + // Present if a TransferOperation has been created for this JobConfig. + string latest_operation_name = 12; +} + +// An entry describing an error that has occurred. +message ErrorLogEntry { + // Required. A URL that refers to the target (a data source, a data sink, + // or an object) with which the error is associated. + string url = 1 [(google.api.field_behavior) = REQUIRED]; + + // A list of messages that carry the error details. + repeated string error_details = 3; +} + +// A summary of errors by error code, plus a count and sample error log +// entries. +message ErrorSummary { + // Required. + google.rpc.Code error_code = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Count of this type of error. + int64 error_count = 2 [(google.api.field_behavior) = REQUIRED]; + + // Error samples. + // + // At most 5 error log entries are recorded for a given + // error code for a single transfer operation. + repeated ErrorLogEntry error_log_entries = 3; +} + +// A collection of counters that report the progress of a transfer operation. +message TransferCounters { + // Objects found in the data source that are scheduled to be transferred, + // excluding any that are filtered based on object conditions or skipped due + // to sync. + int64 objects_found_from_source = 1; + + // Bytes found in the data source that are scheduled to be transferred, + // excluding any that are filtered based on object conditions or skipped due + // to sync. + int64 bytes_found_from_source = 2; + + // Objects found only in the data sink that are scheduled to be deleted. + int64 objects_found_only_from_sink = 3; + + // Bytes found only in the data sink that are scheduled to be deleted. + int64 bytes_found_only_from_sink = 4; + + // Objects in the data source that are not transferred because they already + // exist in the data sink. + int64 objects_from_source_skipped_by_sync = 5; + + // Bytes in the data source that are not transferred because they already + // exist in the data sink. + int64 bytes_from_source_skipped_by_sync = 6; + + // Objects that are copied to the data sink. + int64 objects_copied_to_sink = 7; + + // Bytes that are copied to the data sink. + int64 bytes_copied_to_sink = 8; + + // Objects that are deleted from the data source. + int64 objects_deleted_from_source = 9; + + // Bytes that are deleted from the data source. + int64 bytes_deleted_from_source = 10; + + // Objects that are deleted from the data sink. + int64 objects_deleted_from_sink = 11; + + // Bytes that are deleted from the data sink. + int64 bytes_deleted_from_sink = 12; + + // Objects in the data source that failed to be transferred or that failed + // to be deleted after being transferred. + int64 objects_from_source_failed = 13; + + // Bytes in the data source that failed to be transferred or that failed to + // be deleted after being transferred. + int64 bytes_from_source_failed = 14; + + // Objects that failed to be deleted from the data sink. + int64 objects_failed_to_delete_from_sink = 15; + + // Bytes that failed to be deleted from the data sink. + int64 bytes_failed_to_delete_from_sink = 16; + + // For transfers involving PosixFilesystem only. + // + // Number of directories found while listing. For example, if the root + // directory of the transfer is `base/` and there are two other directories, + // `a/` and `b/` under this directory, the count after listing `base/`, + // `base/a/` and `base/b/` is 3. + int64 directories_found_from_source = 17; + + // For transfers involving PosixFilesystem only. + // + // Number of listing failures for each directory found at the source. + // Potential failures when listing a directory include permission failure or + // block failure. If listing a directory fails, no files in the directory are + // transferred. + int64 directories_failed_to_list_from_source = 18; + + // For transfers involving PosixFilesystem only. + // + // Number of successful listings for each directory found at the source. + int64 directories_successfully_listed_from_source = 19; + + // Number of successfully cleaned up intermediate objects. + int64 intermediate_objects_cleaned_up = 22; + + // Number of intermediate objects failed cleaned up. + int64 intermediate_objects_failed_cleaned_up = 23; +} + +// Specification to configure notifications published to Pub/Sub. +// Notifications are published to the customer-provided topic using the +// following `PubsubMessage.attributes`: +// +// * `"eventType"`: one of the [EventType][google.storagetransfer.v1.NotificationConfig.EventType] values +// * `"payloadFormat"`: one of the [PayloadFormat][google.storagetransfer.v1.NotificationConfig.PayloadFormat] values +// * `"projectId"`: the [project_id][google.storagetransfer.v1.TransferOperation.project_id] of the +// `TransferOperation` +// * `"transferJobName"`: the +// [transfer_job_name][google.storagetransfer.v1.TransferOperation.transfer_job_name] of the +// `TransferOperation` +// * `"transferOperationName"`: the [name][google.storagetransfer.v1.TransferOperation.name] of the +// `TransferOperation` +// +// The `PubsubMessage.data` contains a [TransferOperation][google.storagetransfer.v1.TransferOperation] resource +// formatted according to the specified `PayloadFormat`. +message NotificationConfig { + // Enum for specifying event types for which notifications are to be + // published. + // + // Additional event types may be added in the future. Clients should either + // safely ignore unrecognized event types or explicitly specify which event + // types they are prepared to accept. + enum EventType { + // Illegal value, to avoid allowing a default. + EVENT_TYPE_UNSPECIFIED = 0; + + // `TransferOperation` completed with status + // [SUCCESS][google.storagetransfer.v1.TransferOperation.Status.SUCCESS]. + TRANSFER_OPERATION_SUCCESS = 1; + + // `TransferOperation` completed with status + // [FAILED][google.storagetransfer.v1.TransferOperation.Status.FAILED]. + TRANSFER_OPERATION_FAILED = 2; + + // `TransferOperation` completed with status + // [ABORTED][google.storagetransfer.v1.TransferOperation.Status.ABORTED]. + TRANSFER_OPERATION_ABORTED = 3; + } + + // Enum for specifying the format of a notification message's payload. + enum PayloadFormat { + // Illegal value, to avoid allowing a default. + PAYLOAD_FORMAT_UNSPECIFIED = 0; + + // No payload is included with the notification. + NONE = 1; + + // `TransferOperation` is [formatted as a JSON + // response](https://developers.google.com/protocol-buffers/docs/proto3#json), + // in application/json. + JSON = 2; + } + + // Required. The `Topic.name` of the Pub/Sub topic to which to publish + // notifications. Must be of the format: `projects/{project}/topics/{topic}`. + // Not matching this format results in an + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. + string pubsub_topic = 1 [(google.api.field_behavior) = REQUIRED]; + + // Event types for which a notification is desired. If empty, send + // notifications for all event types. + repeated EventType event_types = 2; + + // Required. The desired format of the notification message payloads. + PayloadFormat payload_format = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies the logging behavior for transfer operations. +// +// For cloud-to-cloud transfers, logs are sent to Cloud Logging. See +// [Read transfer +// logs](https://cloud.google.com/storage-transfer/docs/read-transfer-logs) for +// details. +// +// For transfers to or from a POSIX file system, logs are stored in the +// Cloud Storage bucket that is the source or sink of the transfer. +// See [Managing Transfer for on-premises jobs] +// (https://cloud.google.com/storage-transfer/docs/managing-on-prem-jobs#viewing-logs) +// for details. +message LoggingConfig { + // Loggable actions. + enum LoggableAction { + // Default value. This value is unused. + LOGGABLE_ACTION_UNSPECIFIED = 0; + + // Listing objects in a bucket. + FIND = 1; + + // Deleting objects at the source or the destination. + DELETE = 2; + + // Copying objects to Google Cloud Storage. + COPY = 3; + } + + // Loggable action states. + enum LoggableActionState { + // Default value. This value is unused. + LOGGABLE_ACTION_STATE_UNSPECIFIED = 0; + + // `LoggableAction` completed successfully. `SUCCEEDED` actions are + // logged as [INFO][google.logging.type.LogSeverity.INFO]. + SUCCEEDED = 1; + + // `LoggableAction` terminated in an error state. `FAILED` actions are + // logged as [ERROR][google.logging.type.LogSeverity.ERROR]. + FAILED = 2; + } + + // Specifies the actions to be logged. If empty, no logs are generated. + // Not supported for transfers with PosixFilesystem data sources; use + // [enable_onprem_gcs_transfer_logs][google.storagetransfer.v1.LoggingConfig.enable_onprem_gcs_transfer_logs] instead. + repeated LoggableAction log_actions = 1; + + // States in which `log_actions` are logged. If empty, no logs are generated. + // Not supported for transfers with PosixFilesystem data sources; use + // [enable_onprem_gcs_transfer_logs][google.storagetransfer.v1.LoggingConfig.enable_onprem_gcs_transfer_logs] instead. + repeated LoggableActionState log_action_states = 2; + + // For transfers with a PosixFilesystem source, this option enables the Cloud + // Storage transfer logs for this transfer. + bool enable_onprem_gcs_transfer_logs = 3; +} + +// A description of the execution of a transfer. +message TransferOperation { + // The status of a TransferOperation. + enum Status { + // Zero is an illegal value. + STATUS_UNSPECIFIED = 0; + + // In progress. + IN_PROGRESS = 1; + + // Paused. + PAUSED = 2; + + // Completed successfully. + SUCCESS = 3; + + // Terminated due to an unrecoverable failure. + FAILED = 4; + + // Aborted by the user. + ABORTED = 5; + + // Temporarily delayed by the system. No user action is required. + QUEUED = 6; + } + + // A globally unique ID assigned by the system. + string name = 1; + + // The ID of the Google Cloud project that owns the operation. + string project_id = 2; + + // Transfer specification. + TransferSpec transfer_spec = 3; + + // Notification configuration. + NotificationConfig notification_config = 10; + + // Start time of this transfer execution. + google.protobuf.Timestamp start_time = 4; + + // End time of this transfer execution. + google.protobuf.Timestamp end_time = 5; + + // Status of the transfer operation. + Status status = 6; + + // Information about the progress of the transfer operation. + TransferCounters counters = 7; + + // Summarizes errors encountered with sample error log entries. + repeated ErrorSummary error_breakdowns = 8; + + // The name of the transfer job that triggers this transfer operation. + string transfer_job_name = 9; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json new file mode 100644 index 0000000..5dd0a10 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json @@ -0,0 +1,631 @@ +{ + "clientLibrary": { + "name": "nodejs-storagetransfer", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.storagetransfer.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async", + "title": "StorageTransferService getGoogleServiceAccount Sample", + "origin": "API_DEFINITION", + "description": " Returns the Google service account that is used by Storage Transfer Service to access buckets in the project where transfers run or in other projects. Each Google service account is associated with one Google Cloud project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only be used by Storage Transfer Service.", + "canonical": true, + "file": "storage_transfer_service.get_google_service_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGoogleServiceAccount", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetGoogleServiceAccount", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.GoogleServiceAccount", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "GetGoogleServiceAccount", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetGoogleServiceAccount", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async", + "title": "StorageTransferService createTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Creates a transfer job that runs periodically.", + "canonical": true, + "file": "storage_transfer_service.create_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.CreateTransferJob", + "async": true, + "parameters": [ + { + "name": "transfer_job", + "type": ".google.storagetransfer.v1.TransferJob" + } + ], + "resultType": ".google.storagetransfer.v1.TransferJob", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "CreateTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.CreateTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async", + "title": "StorageTransferService updateTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running already. **Note:** The job's [status][google.storagetransfer.v1.TransferJob.status] field can be modified using this RPC (for example, to set a job's status to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED], [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], or [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]).", + "canonical": true, + "file": "storage_transfer_service.update_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateTransferJob", + "async": true, + "parameters": [ + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "transfer_job", + "type": ".google.storagetransfer.v1.TransferJob" + }, + { + "name": "update_transfer_job_field_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.storagetransfer.v1.TransferJob", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "UpdateTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async", + "title": "StorageTransferService getTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Gets a transfer job.", + "canonical": true, + "file": "storage_transfer_service.get_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetTransferJob", + "async": true, + "parameters": [ + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.TransferJob", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "GetTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async", + "title": "StorageTransferService listTransferJobs Sample", + "origin": "API_DEFINITION", + "description": " Lists transfer jobs.", + "canonical": true, + "file": "storage_transfer_service.list_transfer_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListTransferJobs", + "fullName": "google.storagetransfer.v1.StorageTransferService.ListTransferJobs", + "async": true, + "parameters": [ + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.ListTransferJobsResponse", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "ListTransferJobs", + "fullName": "google.storagetransfer.v1.StorageTransferService.ListTransferJobs", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async", + "title": "StorageTransferService pauseTransferOperation Sample", + "origin": "API_DEFINITION", + "description": " Pauses a transfer operation.", + "canonical": true, + "file": "storage_transfer_service.pause_transfer_operation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PauseTransferOperation", + "fullName": "google.storagetransfer.v1.StorageTransferService.PauseTransferOperation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "PauseTransferOperation", + "fullName": "google.storagetransfer.v1.StorageTransferService.PauseTransferOperation", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async", + "title": "StorageTransferService resumeTransferOperation Sample", + "origin": "API_DEFINITION", + "description": " Resumes a transfer operation that is paused.", + "canonical": true, + "file": "storage_transfer_service.resume_transfer_operation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResumeTransferOperation", + "fullName": "google.storagetransfer.v1.StorageTransferService.ResumeTransferOperation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "ResumeTransferOperation", + "fullName": "google.storagetransfer.v1.StorageTransferService.ResumeTransferOperation", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async", + "title": "StorageTransferService runTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Attempts to start a new TransferOperation for the current TransferJob. A TransferJob has a maximum of one active TransferOperation. If this method is called while a TransferOperation is active, an error will be returned.", + "canonical": true, + "file": "storage_transfer_service.run_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.RunTransferJob", + "async": true, + "parameters": [ + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "RunTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.RunTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async", + "title": "StorageTransferService deleteTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Deletes a transfer job. Deleting a transfer job sets its status to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED].", + "canonical": true, + "file": "storage_transfer_service.delete_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", + "async": true, + "parameters": [ + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "DeleteTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async", + "title": "StorageTransferService createAgentPool Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent pool resource.", + "canonical": true, + "file": "storage_transfer_service.create_agent_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.CreateAgentPool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "agent_pool", + "type": ".google.storagetransfer.v1.AgentPool" + }, + { + "name": "agent_pool_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.AgentPool", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "CreateAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.CreateAgentPool", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async", + "title": "StorageTransferService updateAgentPool Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing agent pool resource.", + "canonical": true, + "file": "storage_transfer_service.update_agent_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateAgentPool", + "async": true, + "parameters": [ + { + "name": "agent_pool", + "type": ".google.storagetransfer.v1.AgentPool" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.storagetransfer.v1.AgentPool", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "UpdateAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateAgentPool", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async", + "title": "StorageTransferService getAgentPool Sample", + "origin": "API_DEFINITION", + "description": " Gets an agent pool.", + "canonical": true, + "file": "storage_transfer_service.get_agent_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetAgentPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.AgentPool", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "GetAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetAgentPool", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async", + "title": "StorageTransferService listAgentPools Sample", + "origin": "API_DEFINITION", + "description": " Lists agent pools.", + "canonical": true, + "file": "storage_transfer_service.list_agent_pools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAgentPools", + "fullName": "google.storagetransfer.v1.StorageTransferService.ListAgentPools", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.ListAgentPoolsResponse", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "ListAgentPools", + "fullName": "google.storagetransfer.v1.StorageTransferService.ListAgentPools", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async", + "title": "StorageTransferService deleteAgentPool Sample", + "origin": "API_DEFINITION", + "description": " Deletes an agent pool.", + "canonical": true, + "file": "storage_transfer_service.delete_agent_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteAgentPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "DeleteAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteAgentPool", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js new file mode 100644 index 0000000..ed5464a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.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(projectId, agentPool, agentPoolId) { + // [START storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Google Cloud project that owns the + * agent pool. + */ + // const projectId = 'abc123' + /** + * Required. The agent pool to create. + */ + // const agentPool = {} + /** + * Required. The ID of the agent pool to create. + * The `agent_pool_id` must meet the following requirements: + * * Length of 128 characters or less. + * * Not start with the string `goog`. + * * Start with a lowercase ASCII character, followed by: + * * Zero or more: lowercase Latin alphabet characters, numerals, + * hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). + * * One or more numerals or lowercase ASCII characters. + * As expressed by the regular expression: + * `^(?!goog)a-z(a-z0-9-._~*a-z0-9)?$`. + */ + // const agentPoolId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callCreateAgentPool() { + // Construct request + const request = { + projectId, + agentPool, + agentPoolId, + }; + + // Run request + const response = await storagetransferClient.createAgentPool(request); + console.log(response); + } + + callCreateAgentPool(); + // [END storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_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/storage_transfer_service.create_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js new file mode 100644 index 0000000..5daf776 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js @@ -0,0 +1,61 @@ +// 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(transferJob) { + // [START storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The job to create. + */ + // const transferJob = {} + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callCreateTransferJob() { + // Construct request + const request = { + transferJob, + }; + + // Run request + const response = await storagetransferClient.createTransferJob(request); + console.log(response); + } + + callCreateTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_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/storage_transfer_service.delete_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js new file mode 100644 index 0000000..fe2d324 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js @@ -0,0 +1,61 @@ +// 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 storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent pool to delete. + */ + // const name = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callDeleteAgentPool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await storagetransferClient.deleteAgentPool(request); + console.log(response); + } + + callDeleteAgentPool(); + // [END storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_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/storage_transfer_service.delete_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.js new file mode 100644 index 0000000..c70c251 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.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(jobName, projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The job to delete. + */ + // const jobName = 'abc123' + /** + * Required. The ID of the Google Cloud project that owns the + * job. + */ + // const projectId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callDeleteTransferJob() { + // Construct request + const request = { + jobName, + projectId, + }; + + // Run request + const response = await storagetransferClient.deleteTransferJob(request); + console.log(response); + } + + callDeleteTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_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/storage_transfer_service.get_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js new file mode 100644 index 0000000..4b30734 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js @@ -0,0 +1,61 @@ +// 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 storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent pool to get. + */ + // const name = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callGetAgentPool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await storagetransferClient.getAgentPool(request); + console.log(response); + } + + callGetAgentPool(); + // [END storagetransfer_v1_generated_StorageTransferService_GetAgentPool_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/storage_transfer_service.get_google_service_account.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js new file mode 100644 index 0000000..1b8411e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js @@ -0,0 +1,62 @@ +// 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(projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Google Cloud project that the Google service + * account is associated with. + */ + // const projectId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callGetGoogleServiceAccount() { + // Construct request + const request = { + projectId, + }; + + // Run request + const response = await storagetransferClient.getGoogleServiceAccount(request); + console.log(response); + } + + callGetGoogleServiceAccount(); + // [END storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_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/storage_transfer_service.get_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.js new file mode 100644 index 0000000..c7cbd13 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.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(jobName, projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The job to get. + */ + // const jobName = 'abc123' + /** + * Required. The ID of the Google Cloud project that owns the + * job. + */ + // const projectId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callGetTransferJob() { + // Construct request + const request = { + jobName, + projectId, + }; + + // Run request + const response = await storagetransferClient.getTransferJob(request); + console.log(response); + } + + callGetTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_GetTransferJob_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/storage_transfer_service.list_agent_pools.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js new file mode 100644 index 0000000..636a133 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js @@ -0,0 +1,80 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Google Cloud project that owns the job. + */ + // const projectId = 'abc123' + /** + * An optional list of query parameters specified as JSON text in the + * form of: + * `{"agentPoolNames":"agentpool1","agentpool2",... }` + * Since `agentPoolNames` support multiple values, its values must be + * specified with array notation. When the filter is either empty or not + * provided, the list returns all agent pools for the project. + */ + // const filter = 'abc123' + /** + * The list page size. The max allowed value is `256`. + */ + // const pageSize = 1234 + /** + * The list page token. + */ + // const pageToken = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callListAgentPools() { + // Construct request + const request = { + projectId, + }; + + // Run request + const iterable = await storagetransferClient.listAgentPoolsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAgentPools(); + // [END storagetransfer_v1_generated_StorageTransferService_ListAgentPools_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/storage_transfer_service.list_transfer_jobs.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js new file mode 100644 index 0000000..fa1d170 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.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(filter) { + // [START storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A list of query parameters specified as JSON text in the form of: + * `{"projectId":"my_project_id", + * "jobNames":"jobid1","jobid2",..., + * "jobStatuses":"status1","status2",... }` + * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `projectId` is required. + * `jobNames` and `jobStatuses` are optional. The valid values for + * `jobStatuses` are case-insensitive: + * ENABLED google.storagetransfer.v1.TransferJob.Status.ENABLED, + * DISABLED google.storagetransfer.v1.TransferJob.Status.DISABLED, and + * DELETED google.storagetransfer.v1.TransferJob.Status.DELETED. + */ + // const filter = 'abc123' + /** + * The list page size. The max allowed value is 256. + */ + // const pageSize = 1234 + /** + * The list page token. + */ + // const pageToken = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callListTransferJobs() { + // Construct request + const request = { + filter, + }; + + // Run request + const iterable = await storagetransferClient.listTransferJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListTransferJobs(); + // [END storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_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/storage_transfer_service.pause_transfer_operation.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js new file mode 100644 index 0000000..9a11fd3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js @@ -0,0 +1,61 @@ +// 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 storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the transfer operation. + */ + // const name = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callPauseTransferOperation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await storagetransferClient.pauseTransferOperation(request); + console.log(response); + } + + callPauseTransferOperation(); + // [END storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_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/storage_transfer_service.resume_transfer_operation.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js new file mode 100644 index 0000000..565ac82 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js @@ -0,0 +1,61 @@ +// 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 storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the transfer operation. + */ + // const name = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callResumeTransferOperation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await storagetransferClient.resumeTransferOperation(request); + console.log(response); + } + + callResumeTransferOperation(); + // [END storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_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/storage_transfer_service.run_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js new file mode 100644 index 0000000..ce83387 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js @@ -0,0 +1,68 @@ +// 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(jobName, projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the transfer job. + */ + // const jobName = 'abc123' + /** + * Required. The ID of the Google Cloud project that owns the transfer + * job. + */ + // const projectId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callRunTransferJob() { + // Construct request + const request = { + jobName, + projectId, + }; + + // Run request + const [operation] = await storagetransferClient.runTransferJob(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_RunTransferJob_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/storage_transfer_service.update_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.js new file mode 100644 index 0000000..b2cf855 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.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(agentPool) { + // [START storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent pool to update. `agent_pool` is expected to specify following + * fields: + * * name google.storagetransfer.v1.AgentPool.name + * * display_name google.storagetransfer.v1.AgentPool.display_name + * * bandwidth_limit google.storagetransfer.v1.AgentPool.bandwidth_limit + * An `UpdateAgentPoolRequest` with any other fields is rejected + * with the error INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. + */ + // const agentPool = {} + /** + * The field mask + * (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) + * of the fields in `agentPool` to update in this request. + * The following `agentPool` fields can be updated: + * * display_name google.storagetransfer.v1.AgentPool.display_name + * * bandwidth_limit google.storagetransfer.v1.AgentPool.bandwidth_limit + */ + // const updateMask = {} + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callUpdateAgentPool() { + // Construct request + const request = { + agentPool, + }; + + // Run request + const response = await storagetransferClient.updateAgentPool(request); + console.log(response); + } + + callUpdateAgentPool(); + // [END storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_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/storage_transfer_service.update_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js new file mode 100644 index 0000000..7961e98 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js @@ -0,0 +1,94 @@ +// 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(jobName, projectId, transferJob) { + // [START storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of job to update. + */ + // const jobName = 'abc123' + /** + * Required. The ID of the Google Cloud project that owns the + * job. + */ + // const projectId = 'abc123' + /** + * Required. The job to update. `transferJob` is expected to specify one or more of + * five fields: description google.storagetransfer.v1.TransferJob.description, + * transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec, + * notification_config google.storagetransfer.v1.TransferJob.notification_config, + * logging_config google.storagetransfer.v1.TransferJob.logging_config, and + * status google.storagetransfer.v1.TransferJob.status. An `UpdateTransferJobRequest` that specifies + * other fields are rejected with the error + * INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. Updating a job status + * to DELETED google.storagetransfer.v1.TransferJob.Status.DELETED requires + * `storagetransfer.jobs.delete` permission. + */ + // const transferJob = {} + /** + * The field mask of the fields in `transferJob` that are to be updated in + * this request. Fields in `transferJob` that can be updated are: + * description google.storagetransfer.v1.TransferJob.description, + * transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec, + * notification_config google.storagetransfer.v1.TransferJob.notification_config, + * logging_config google.storagetransfer.v1.TransferJob.logging_config, and + * status google.storagetransfer.v1.TransferJob.status. To update the `transfer_spec` of the job, a + * complete transfer specification must be provided. An incomplete + * specification missing any required fields is rejected with the error + * INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. + */ + // const updateTransferJobFieldMask = {} + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callUpdateTransferJob() { + // Construct request + const request = { + jobName, + projectId, + transferJob, + }; + + // Run request + const response = await storagetransferClient.updateTransferJob(request); + console.log(response); + } + + callUpdateTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..b2ff704 --- /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 StorageTransferServiceClient = v1.StorageTransferServiceClient; +type StorageTransferServiceClient = v1.StorageTransferServiceClient; +export {v1, StorageTransferServiceClient}; +export default {v1, StorageTransferServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..4155aeb --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,171 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.storagetransfer.v1", + "libraryPackage": "@google-cloud/storage-transfer", + "services": { + "StorageTransferService": { + "clients": { + "grpc": { + "libraryClient": "StorageTransferServiceClient", + "rpcs": { + "GetGoogleServiceAccount": { + "methods": [ + "getGoogleServiceAccount" + ] + }, + "CreateTransferJob": { + "methods": [ + "createTransferJob" + ] + }, + "UpdateTransferJob": { + "methods": [ + "updateTransferJob" + ] + }, + "GetTransferJob": { + "methods": [ + "getTransferJob" + ] + }, + "PauseTransferOperation": { + "methods": [ + "pauseTransferOperation" + ] + }, + "ResumeTransferOperation": { + "methods": [ + "resumeTransferOperation" + ] + }, + "DeleteTransferJob": { + "methods": [ + "deleteTransferJob" + ] + }, + "CreateAgentPool": { + "methods": [ + "createAgentPool" + ] + }, + "UpdateAgentPool": { + "methods": [ + "updateAgentPool" + ] + }, + "GetAgentPool": { + "methods": [ + "getAgentPool" + ] + }, + "DeleteAgentPool": { + "methods": [ + "deleteAgentPool" + ] + }, + "RunTransferJob": { + "methods": [ + "runTransferJob" + ] + }, + "ListTransferJobs": { + "methods": [ + "listTransferJobs", + "listTransferJobsStream", + "listTransferJobsAsync" + ] + }, + "ListAgentPools": { + "methods": [ + "listAgentPools", + "listAgentPoolsStream", + "listAgentPoolsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "StorageTransferServiceClient", + "rpcs": { + "GetGoogleServiceAccount": { + "methods": [ + "getGoogleServiceAccount" + ] + }, + "CreateTransferJob": { + "methods": [ + "createTransferJob" + ] + }, + "UpdateTransferJob": { + "methods": [ + "updateTransferJob" + ] + }, + "GetTransferJob": { + "methods": [ + "getTransferJob" + ] + }, + "PauseTransferOperation": { + "methods": [ + "pauseTransferOperation" + ] + }, + "ResumeTransferOperation": { + "methods": [ + "resumeTransferOperation" + ] + }, + "DeleteTransferJob": { + "methods": [ + "deleteTransferJob" + ] + }, + "CreateAgentPool": { + "methods": [ + "createAgentPool" + ] + }, + "UpdateAgentPool": { + "methods": [ + "updateAgentPool" + ] + }, + "GetAgentPool": { + "methods": [ + "getAgentPool" + ] + }, + "DeleteAgentPool": { + "methods": [ + "deleteAgentPool" + ] + }, + "RunTransferJob": { + "methods": [ + "runTransferJob" + ] + }, + "ListTransferJobs": { + "methods": [ + "listTransferJobs", + "listTransferJobsStream", + "listTransferJobsAsync" + ] + }, + "ListAgentPools": { + "methods": [ + "listAgentPools", + "listAgentPoolsStream", + "listAgentPoolsAsync" + ] + } + } + } + } + } + } +} 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..f0a69d4 --- /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 {StorageTransferServiceClient} from './storage_transfer_service_client'; diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts b/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts new file mode 100644 index 0000000..2a394a9 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts @@ -0,0 +1,1916 @@ +// 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/storage_transfer_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './storage_transfer_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Storage Transfer Service and its protos. + * Transfers data between between Google Cloud Storage buckets or from a data + * source external to Google to a Cloud Storage bucket. + * @class + * @memberof v1 + */ +export class StorageTransferServiceClient { + 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; + storageTransferServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of StorageTransferServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new StorageTransferServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof StorageTransferServiceClient; + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPoolsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project_id}/agentPools/{agent_pool_id}' + ), + }; + + // 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 = { + listTransferJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'transferJobs'), + listAgentPools: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'agentPools') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=transferOperations/**}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=transferOperations/**}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=transferOperations}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const runTransferJobResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const runTransferJobMetadata = protoFilesRoot.lookup( + '.google.storagetransfer.v1.TransferOperation') as gax.protobuf.Type; + + this.descriptors.longrunning = { + runTransferJob: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runTransferJobResponse.decode.bind(runTransferJobResponse), + runTransferJobMetadata.decode.bind(runTransferJobMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.storagetransfer.v1.StorageTransferService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.storageTransferServiceStub) { + return this.storageTransferServiceStub; + } + + // Put together the "service stub" for + // google.storagetransfer.v1.StorageTransferService. + this.storageTransferServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.storagetransfer.v1.StorageTransferService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.storagetransfer.v1.StorageTransferService, + 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 storageTransferServiceStubMethods = + ['getGoogleServiceAccount', 'createTransferJob', 'updateTransferJob', 'getTransferJob', 'listTransferJobs', 'pauseTransferOperation', 'resumeTransferOperation', 'runTransferJob', 'deleteTransferJob', 'createAgentPool', 'updateAgentPool', 'getAgentPool', 'listAgentPools', 'deleteAgentPool']; + for (const methodName of storageTransferServiceStubMethods) { + const callPromise = this.storageTransferServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.storageTransferServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'storagetransfer.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 'storagetransfer.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 -- + // ------------------- +/** + * Returns the Google service account that is used by Storage Transfer + * Service to access buckets in the project where transfers + * run or in other projects. Each Google service account is associated + * with one Google Cloud project. Users + * should add this service account to the Google Cloud Storage bucket + * ACLs to grant access to Storage Transfer Service. This service + * account is created and owned by Storage Transfer Service and can + * only be used by Storage Transfer Service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that the Google service + * account is associated with. + * @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 [GoogleServiceAccount]{@link google.storagetransfer.v1.GoogleServiceAccount}. + * 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/storage_transfer_service.get_google_service_account.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async + */ + getGoogleServiceAccount( + request?: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|undefined, {}|undefined + ]>; + getGoogleServiceAccount( + request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, + {}|null|undefined>): void; + getGoogleServiceAccount( + request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, + callback: Callback< + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, + {}|null|undefined>): void; + getGoogleServiceAccount( + request?: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId || '', + }); + this.initialize(); + return this.innerApiCalls.getGoogleServiceAccount(request, options, callback); + } +/** + * Creates a transfer job that runs periodically. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.storagetransfer.v1.TransferJob} request.transferJob + * Required. The job to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TransferJob]{@link google.storagetransfer.v1.TransferJob}. + * 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/storage_transfer_service.create_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async + */ + createTransferJob( + request?: protos.google.storagetransfer.v1.ICreateTransferJobRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|undefined, {}|undefined + ]>; + createTransferJob( + request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, + {}|null|undefined>): void; + createTransferJob( + request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, + {}|null|undefined>): void; + createTransferJob( + request?: protos.google.storagetransfer.v1.ICreateTransferJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.createTransferJob(request, options, callback); + } +/** + * Updates a transfer job. Updating a job's transfer spec does not affect + * transfer operations that are running already. + * + * **Note:** The job's {@link google.storagetransfer.v1.TransferJob.status|status} field can be modified + * using this RPC (for example, to set a job's status to + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}, + * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, or + * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.jobName + * Required. The name of job to update. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the + * job. + * @param {google.storagetransfer.v1.TransferJob} request.transferJob + * Required. The job to update. `transferJob` is expected to specify one or more of + * five fields: {@link google.storagetransfer.v1.TransferJob.description|description}, + * {@link google.storagetransfer.v1.TransferJob.transfer_spec|transfer_spec}, + * {@link google.storagetransfer.v1.TransferJob.notification_config|notification_config}, + * {@link google.storagetransfer.v1.TransferJob.logging_config|logging_config}, and + * {@link google.storagetransfer.v1.TransferJob.status|status}. An `UpdateTransferJobRequest` that specifies + * other fields are rejected with the error + * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. Updating a job status + * to {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED} requires + * `storagetransfer.jobs.delete` permission. + * @param {google.protobuf.FieldMask} request.updateTransferJobFieldMask + * The field mask of the fields in `transferJob` that are to be updated in + * this request. Fields in `transferJob` that can be updated are: + * {@link google.storagetransfer.v1.TransferJob.description|description}, + * {@link google.storagetransfer.v1.TransferJob.transfer_spec|transfer_spec}, + * {@link google.storagetransfer.v1.TransferJob.notification_config|notification_config}, + * {@link google.storagetransfer.v1.TransferJob.logging_config|logging_config}, and + * {@link google.storagetransfer.v1.TransferJob.status|status}. To update the `transfer_spec` of the job, a + * complete transfer specification must be provided. An incomplete + * specification missing any required fields is rejected with the error + * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. + * @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 [TransferJob]{@link google.storagetransfer.v1.TransferJob}. + * 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/storage_transfer_service.update_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async + */ + updateTransferJob( + request?: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|undefined, {}|undefined + ]>; + updateTransferJob( + request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, + {}|null|undefined>): void; + updateTransferJob( + request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, + {}|null|undefined>): void; + updateTransferJob( + request?: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'job_name': request.jobName || '', + }); + this.initialize(); + return this.innerApiCalls.updateTransferJob(request, options, callback); + } +/** + * Gets a transfer job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.jobName + * Required. The job to get. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the + * job. + * @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 [TransferJob]{@link google.storagetransfer.v1.TransferJob}. + * 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/storage_transfer_service.get_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async + */ + getTransferJob( + request?: protos.google.storagetransfer.v1.IGetTransferJobRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|undefined, {}|undefined + ]>; + getTransferJob( + request: protos.google.storagetransfer.v1.IGetTransferJobRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, + {}|null|undefined>): void; + getTransferJob( + request: protos.google.storagetransfer.v1.IGetTransferJobRequest, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, + {}|null|undefined>): void; + getTransferJob( + request?: protos.google.storagetransfer.v1.IGetTransferJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'job_name': request.jobName || '', + }); + this.initialize(); + return this.innerApiCalls.getTransferJob(request, options, callback); + } +/** + * Pauses a transfer operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the transfer operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/storage_transfer_service.pause_transfer_operation.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async + */ + pauseTransferOperation( + request?: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|undefined, {}|undefined + ]>; + pauseTransferOperation( + request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, + {}|null|undefined>): void; + pauseTransferOperation( + request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, + {}|null|undefined>): void; + pauseTransferOperation( + request?: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.pauseTransferOperation(request, options, callback); + } +/** + * Resumes a transfer operation that is paused. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the transfer operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/storage_transfer_service.resume_transfer_operation.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async + */ + resumeTransferOperation( + request?: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|undefined, {}|undefined + ]>; + resumeTransferOperation( + request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, + {}|null|undefined>): void; + resumeTransferOperation( + request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, + {}|null|undefined>): void; + resumeTransferOperation( + request?: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.resumeTransferOperation(request, options, callback); + } +/** + * Deletes a transfer job. Deleting a transfer job sets its status to + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.jobName + * Required. The job to delete. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the + * job. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/storage_transfer_service.delete_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async + */ + deleteTransferJob( + request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|undefined, {}|undefined + ]>; + deleteTransferJob( + request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, + {}|null|undefined>): void; + deleteTransferJob( + request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, + {}|null|undefined>): void; + deleteTransferJob( + request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'job_name': request.jobName || '', + }); + this.initialize(); + return this.innerApiCalls.deleteTransferJob(request, options, callback); + } +/** + * Creates an agent pool resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the + * agent pool. + * @param {google.storagetransfer.v1.AgentPool} request.agentPool + * Required. The agent pool to create. + * @param {string} request.agentPoolId + * Required. The ID of the agent pool to create. + * + * The `agent_pool_id` must meet the following requirements: + * + * * Length of 128 characters or less. + * * Not start with the string `goog`. + * * Start with a lowercase ASCII character, followed by: + * * Zero or more: lowercase Latin alphabet characters, numerals, + * hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). + * * One or more numerals or lowercase ASCII characters. + * + * As expressed by the regular expression: + * `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`. + * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. + * 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/storage_transfer_service.create_agent_pool.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async + */ + createAgentPool( + request?: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|undefined, {}|undefined + ]>; + createAgentPool( + request: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + createAgentPool( + request: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + createAgentPool( + request?: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId || '', + }); + this.initialize(); + return this.innerApiCalls.createAgentPool(request, options, callback); + } +/** + * Updates an existing agent pool resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.storagetransfer.v1.AgentPool} request.agentPool + * Required. The agent pool to update. `agent_pool` is expected to specify following + * fields: + * + * * {@link google.storagetransfer.v1.AgentPool.name|name} + * + * * {@link google.storagetransfer.v1.AgentPool.display_name|display_name} + * + * * {@link google.storagetransfer.v1.AgentPool.bandwidth_limit|bandwidth_limit} + * An `UpdateAgentPoolRequest` with any other fields is rejected + * with the error {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. + * @param {google.protobuf.FieldMask} request.updateMask + * The [field mask] + * (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) + * of the fields in `agentPool` to update in this request. + * The following `agentPool` fields can be updated: + * + * * {@link google.storagetransfer.v1.AgentPool.display_name|display_name} + * + * * {@link google.storagetransfer.v1.AgentPool.bandwidth_limit|bandwidth_limit} + * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. + * 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/storage_transfer_service.update_agent_pool.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async + */ + updateAgentPool( + request?: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|undefined, {}|undefined + ]>; + updateAgentPool( + request: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + updateAgentPool( + request: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + updateAgentPool( + request?: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'agent_pool.name': request.agentPool!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAgentPool(request, options, callback); + } +/** + * Gets an agent pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the agent pool to get. + * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. + * 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/storage_transfer_service.get_agent_pool.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async + */ + getAgentPool( + request?: protos.google.storagetransfer.v1.IGetAgentPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|undefined, {}|undefined + ]>; + getAgentPool( + request: protos.google.storagetransfer.v1.IGetAgentPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + getAgentPool( + request: protos.google.storagetransfer.v1.IGetAgentPoolRequest, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + getAgentPool( + request?: protos.google.storagetransfer.v1.IGetAgentPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getAgentPool(request, options, callback); + } +/** + * Deletes an agent pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the agent pool to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/storage_transfer_service.delete_agent_pool.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async + */ + deleteAgentPool( + request?: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|undefined, {}|undefined + ]>; + deleteAgentPool( + request: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + deleteAgentPool( + request: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + deleteAgentPool( + request?: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteAgentPool(request, options, callback); + } + +/** + * Attempts to start a new TransferOperation for the current TransferJob. A + * TransferJob has a maximum of one active TransferOperation. If this method + * is called while a TransferOperation is active, an error will be returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.jobName + * Required. The name of the transfer job. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the transfer + * job. + * @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/storage_transfer_service.run_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async + */ + runTransferJob( + request?: protos.google.storagetransfer.v1.IRunTransferJobRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runTransferJob( + request: protos.google.storagetransfer.v1.IRunTransferJobRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runTransferJob( + request: protos.google.storagetransfer.v1.IRunTransferJobRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runTransferJob( + request?: protos.google.storagetransfer.v1.IRunTransferJobRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'job_name': request.jobName || '', + }); + this.initialize(); + return this.innerApiCalls.runTransferJob(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runTransferJob()`. + * @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/storage_transfer_service.run_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async + */ + async checkRunTransferJobProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runTransferJob, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists transfer jobs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.filter + * Required. A list of query parameters specified as JSON text in the form of: + * `{"projectId":"my_project_id", + * "jobNames":["jobid1","jobid2",...], + * "jobStatuses":["status1","status2",...]}` + * + * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `projectId` is required. + * `jobNames` and `jobStatuses` are optional. The valid values for + * `jobStatuses` are case-insensitive: + * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, + * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * @param {number} request.pageSize + * The list page size. The max allowed value is 256. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [TransferJob]{@link google.storagetransfer.v1.TransferJob}. + * 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 `listTransferJobsAsync()` + * 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. + */ + listTransferJobs( + request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob[], + protos.google.storagetransfer.v1.IListTransferJobsRequest|null, + protos.google.storagetransfer.v1.IListTransferJobsResponse + ]>; + listTransferJobs( + request: protos.google.storagetransfer.v1.IListTransferJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.storagetransfer.v1.IListTransferJobsRequest, + protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, + protos.google.storagetransfer.v1.ITransferJob>): void; + listTransferJobs( + request: protos.google.storagetransfer.v1.IListTransferJobsRequest, + callback: PaginationCallback< + protos.google.storagetransfer.v1.IListTransferJobsRequest, + protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, + protos.google.storagetransfer.v1.ITransferJob>): void; + listTransferJobs( + request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.storagetransfer.v1.IListTransferJobsRequest, + protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, + protos.google.storagetransfer.v1.ITransferJob>, + callback?: PaginationCallback< + protos.google.storagetransfer.v1.IListTransferJobsRequest, + protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, + protos.google.storagetransfer.v1.ITransferJob>): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob[], + protos.google.storagetransfer.v1.IListTransferJobsRequest|null, + protos.google.storagetransfer.v1.IListTransferJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.listTransferJobs(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.filter + * Required. A list of query parameters specified as JSON text in the form of: + * `{"projectId":"my_project_id", + * "jobNames":["jobid1","jobid2",...], + * "jobStatuses":["status1","status2",...]}` + * + * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `projectId` is required. + * `jobNames` and `jobStatuses` are optional. The valid values for + * `jobStatuses` are case-insensitive: + * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, + * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * @param {number} request.pageSize + * The list page size. The max allowed value is 256. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [TransferJob]{@link google.storagetransfer.v1.TransferJob} 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 `listTransferJobsAsync()` + * 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. + */ + listTransferJobsStream( + request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listTransferJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTransferJobs.createStream( + this.innerApiCalls.listTransferJobs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTransferJobs`, 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.filter + * Required. A list of query parameters specified as JSON text in the form of: + * `{"projectId":"my_project_id", + * "jobNames":["jobid1","jobid2",...], + * "jobStatuses":["status1","status2",...]}` + * + * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `projectId` is required. + * `jobNames` and `jobStatuses` are optional. The valid values for + * `jobStatuses` are case-insensitive: + * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, + * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * @param {number} request.pageSize + * The list page size. The max allowed value is 256. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [TransferJob]{@link google.storagetransfer.v1.TransferJob}. 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/storage_transfer_service.list_transfer_jobs.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async + */ + listTransferJobsAsync( + request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listTransferJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTransferJobs.asyncIterate( + this.innerApiCalls['listTransferJobs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists agent pools. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the job. + * @param {string} request.filter + * An optional list of query parameters specified as JSON text in the + * form of: + * + * `{"agentPoolNames":["agentpool1","agentpool2",...]}` + * + * Since `agentPoolNames` support multiple values, its values must be + * specified with array notation. When the filter is either empty or not + * provided, the list returns all agent pools for the project. + * @param {number} request.pageSize + * The list page size. The max allowed value is `256`. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [AgentPool]{@link google.storagetransfer.v1.AgentPool}. + * 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 `listAgentPoolsAsync()` + * 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. + */ + listAgentPools( + request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool[], + protos.google.storagetransfer.v1.IListAgentPoolsRequest|null, + protos.google.storagetransfer.v1.IListAgentPoolsResponse + ]>; + listAgentPools( + request: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.storagetransfer.v1.IListAgentPoolsRequest, + protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, + protos.google.storagetransfer.v1.IAgentPool>): void; + listAgentPools( + request: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + callback: PaginationCallback< + protos.google.storagetransfer.v1.IListAgentPoolsRequest, + protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, + protos.google.storagetransfer.v1.IAgentPool>): void; + listAgentPools( + request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.storagetransfer.v1.IListAgentPoolsRequest, + protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, + protos.google.storagetransfer.v1.IAgentPool>, + callback?: PaginationCallback< + protos.google.storagetransfer.v1.IListAgentPoolsRequest, + protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, + protos.google.storagetransfer.v1.IAgentPool>): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool[], + protos.google.storagetransfer.v1.IListAgentPoolsRequest|null, + protos.google.storagetransfer.v1.IListAgentPoolsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId || '', + }); + this.initialize(); + return this.innerApiCalls.listAgentPools(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.projectId + * Required. The ID of the Google Cloud project that owns the job. + * @param {string} request.filter + * An optional list of query parameters specified as JSON text in the + * form of: + * + * `{"agentPoolNames":["agentpool1","agentpool2",...]}` + * + * Since `agentPoolNames` support multiple values, its values must be + * specified with array notation. When the filter is either empty or not + * provided, the list returns all agent pools for the project. + * @param {number} request.pageSize + * The list page size. The max allowed value is `256`. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [AgentPool]{@link google.storagetransfer.v1.AgentPool} 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 `listAgentPoolsAsync()` + * 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. + */ + listAgentPoolsStream( + request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId || '', + }); + const defaultCallSettings = this._defaults['listAgentPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAgentPools.createStream( + this.innerApiCalls.listAgentPools as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAgentPools`, 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.projectId + * Required. The ID of the Google Cloud project that owns the job. + * @param {string} request.filter + * An optional list of query parameters specified as JSON text in the + * form of: + * + * `{"agentPoolNames":["agentpool1","agentpool2",...]}` + * + * Since `agentPoolNames` support multiple values, its values must be + * specified with array notation. When the filter is either empty or not + * provided, the list returns all agent pools for the project. + * @param {number} request.pageSize + * The list page size. The max allowed value is `256`. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [AgentPool]{@link google.storagetransfer.v1.AgentPool}. 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/storage_transfer_service.list_agent_pools.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async + */ + listAgentPoolsAsync( + request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId || '', + }); + const defaultCallSettings = this._defaults['listAgentPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAgentPools.asyncIterate( + this.innerApiCalls['listAgentPools'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agentPools resource name string. + * + * @param {string} project_id + * @param {string} agent_pool_id + * @returns {string} Resource name string. + */ + agentPoolsPath(projectId:string,agentPoolId:string) { + return this.pathTemplates.agentPoolsPathTemplate.render({ + project_id: projectId, + agent_pool_id: agentPoolId, + }); + } + + /** + * Parse the project_id from AgentPools resource. + * + * @param {string} agentPoolsName + * A fully-qualified path representing agentPools resource. + * @returns {string} A string representing the project_id. + */ + matchProjectIdFromAgentPoolsName(agentPoolsName: string) { + return this.pathTemplates.agentPoolsPathTemplate.match(agentPoolsName).project_id; + } + + /** + * Parse the agent_pool_id from AgentPools resource. + * + * @param {string} agentPoolsName + * A fully-qualified path representing agentPools resource. + * @returns {string} A string representing the agent_pool_id. + */ + matchAgentPoolIdFromAgentPoolsName(agentPoolsName: string) { + return this.pathTemplates.agentPoolsPathTemplate.match(agentPoolsName).agent_pool_id; + } + + /** + * 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.storageTransferServiceStub && !this._terminated) { + return this.storageTransferServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json b/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json new file mode 100644 index 0000000..93b4537 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json @@ -0,0 +1,108 @@ +{ + "interfaces": { + "google.storagetransfer.v1.StorageTransferService": { + "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 + }, + "264268458a9e88347dbacbd9398202ff5885a40b": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 2, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetGoogleServiceAccount": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "CreateTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "GetTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListTransferJobs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "PauseTransferOperation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ResumeTransferOperation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "RunTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "CreateAgentPool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "UpdateAgentPool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "GetAgentPool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListAgentPools": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteAgentPool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json b/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json new file mode 100644 index 0000000..ea755b4 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/storagetransfer/v1/transfer.proto", + "../../protos/google/storagetransfer/v1/transfer_types.proto" +] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..842da4d --- /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 storagetransfer = require('@google-cloud/storage-transfer'); + +function main() { + const storageTransferServiceClient = new storagetransfer.StorageTransferServiceClient(); +} + +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..458ee50 --- /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 {StorageTransferServiceClient} from '@google-cloud/storage-transfer'; + +// check that the client class type name can be used +function doStuffWithStorageTransferServiceClient(client: StorageTransferServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const storageTransferServiceClient = new StorageTransferServiceClient(); + doStuffWithStorageTransferServiceClient(storageTransferServiceClient); +} + +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..557a575 --- /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_storage_transfer_service_v1.ts b/owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts new file mode 100644 index 0000000..0298604 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts @@ -0,0 +1,2080 @@ +// 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 storagetransferserviceModule 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.StorageTransferServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = storagetransferserviceModule.v1.StorageTransferServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = storagetransferserviceModule.v1.StorageTransferServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = storagetransferserviceModule.v1.StorageTransferServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.storageTransferServiceStub, undefined); + await client.initialize(); + assert(client.storageTransferServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.storageTransferServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.storageTransferServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + 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 storagetransferserviceModule.v1.StorageTransferServiceClient({ + 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('getGoogleServiceAccount', () => { + it('invokes getGoogleServiceAccount without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.GoogleServiceAccount()); + client.innerApiCalls.getGoogleServiceAccount = stubSimpleCall(expectedResponse); + const [response] = await client.getGoogleServiceAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getGoogleServiceAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getGoogleServiceAccount without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.GoogleServiceAccount()); + client.innerApiCalls.getGoogleServiceAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGoogleServiceAccount( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IGoogleServiceAccount|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getGoogleServiceAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getGoogleServiceAccount with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getGoogleServiceAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGoogleServiceAccount(request), expectedError); + assert((client.innerApiCalls.getGoogleServiceAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getGoogleServiceAccount with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest()); + request.projectId = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getGoogleServiceAccount(request), expectedError); + }); + }); + + describe('createTransferJob', () => { + it('invokes createTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateTransferJobRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); + client.innerApiCalls.createTransferJob = stubSimpleCall(expectedResponse); + const [response] = await client.createTransferJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateTransferJobRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); + client.innerApiCalls.createTransferJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTransferJob( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createTransferJob with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateTransferJobRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.createTransferJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createTransferJob(request), expectedError); + assert((client.innerApiCalls.createTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTransferJob with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateTransferJobRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createTransferJob(request), expectedError); + }); + }); + + describe('updateTransferJob', () => { + it('invokes updateTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); + client.innerApiCalls.updateTransferJob = stubSimpleCall(expectedResponse); + const [response] = await client.updateTransferJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); + client.innerApiCalls.updateTransferJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTransferJob( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateTransferJob with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTransferJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateTransferJob(request), expectedError); + assert((client.innerApiCalls.updateTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateTransferJob with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateTransferJobRequest()); + request.jobName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateTransferJob(request), expectedError); + }); + }); + + describe('getTransferJob', () => { + it('invokes getTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); + client.innerApiCalls.getTransferJob = stubSimpleCall(expectedResponse); + const [response] = await client.getTransferJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); + client.innerApiCalls.getTransferJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTransferJob( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getTransferJob with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getTransferJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTransferJob(request), expectedError); + assert((client.innerApiCalls.getTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getTransferJob with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetTransferJobRequest()); + request.jobName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getTransferJob(request), expectedError); + }); + }); + + describe('pauseTransferOperation', () => { + it('invokes pauseTransferOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.PauseTransferOperationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.pauseTransferOperation = stubSimpleCall(expectedResponse); + const [response] = await client.pauseTransferOperation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pauseTransferOperation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pauseTransferOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.PauseTransferOperationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.pauseTransferOperation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pauseTransferOperation( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pauseTransferOperation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes pauseTransferOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.PauseTransferOperationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.pauseTransferOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.pauseTransferOperation(request), expectedError); + assert((client.innerApiCalls.pauseTransferOperation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pauseTransferOperation with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.PauseTransferOperationRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.pauseTransferOperation(request), expectedError); + }); + }); + + describe('resumeTransferOperation', () => { + it('invokes resumeTransferOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ResumeTransferOperationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.resumeTransferOperation = stubSimpleCall(expectedResponse); + const [response] = await client.resumeTransferOperation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resumeTransferOperation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes resumeTransferOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ResumeTransferOperationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.resumeTransferOperation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resumeTransferOperation( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resumeTransferOperation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes resumeTransferOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ResumeTransferOperationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.resumeTransferOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.resumeTransferOperation(request), expectedError); + assert((client.innerApiCalls.resumeTransferOperation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes resumeTransferOperation with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ResumeTransferOperationRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.resumeTransferOperation(request), expectedError); + }); + }); + + describe('deleteTransferJob', () => { + it('invokes deleteTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTransferJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTransferJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTransferJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTransferJob( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteTransferJob with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTransferJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteTransferJob(request), expectedError); + assert((client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteTransferJob with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteTransferJobRequest()); + request.jobName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteTransferJob(request), expectedError); + }); + }); + + describe('createAgentPool', () => { + it('invokes createAgentPool without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateAgentPoolRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); + client.innerApiCalls.createAgentPool = stubSimpleCall(expectedResponse); + const [response] = await client.createAgentPool(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createAgentPool without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateAgentPoolRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); + client.innerApiCalls.createAgentPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAgentPool( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createAgentPool with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateAgentPoolRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAgentPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createAgentPool(request), expectedError); + assert((client.innerApiCalls.createAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createAgentPool with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateAgentPoolRequest()); + request.projectId = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createAgentPool(request), expectedError); + }); + }); + + describe('updateAgentPool', () => { + it('invokes updateAgentPool without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateAgentPoolRequest()); + request.agentPool = {}; + request.agentPool.name = ''; + const expectedHeaderRequestParams = "agent_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); + client.innerApiCalls.updateAgentPool = stubSimpleCall(expectedResponse); + const [response] = await client.updateAgentPool(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAgentPool without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateAgentPoolRequest()); + request.agentPool = {}; + request.agentPool.name = ''; + const expectedHeaderRequestParams = "agent_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); + client.innerApiCalls.updateAgentPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAgentPool( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateAgentPool with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateAgentPoolRequest()); + request.agentPool = {}; + request.agentPool.name = ''; + const expectedHeaderRequestParams = "agent_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAgentPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAgentPool(request), expectedError); + assert((client.innerApiCalls.updateAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAgentPool with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateAgentPoolRequest()); + request.agentPool = {}; + request.agentPool.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateAgentPool(request), expectedError); + }); + }); + + describe('getAgentPool', () => { + it('invokes getAgentPool without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetAgentPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); + client.innerApiCalls.getAgentPool = stubSimpleCall(expectedResponse); + const [response] = await client.getAgentPool(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAgentPool without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetAgentPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); + client.innerApiCalls.getAgentPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAgentPool( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getAgentPool with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetAgentPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAgentPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAgentPool(request), expectedError); + assert((client.innerApiCalls.getAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAgentPool with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetAgentPoolRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAgentPool(request), expectedError); + }); + }); + + describe('deleteAgentPool', () => { + it('invokes deleteAgentPool without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteAgentPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAgentPool = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAgentPool(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAgentPool without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteAgentPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAgentPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAgentPool( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAgentPool with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteAgentPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAgentPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAgentPool(request), expectedError); + assert((client.innerApiCalls.deleteAgentPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAgentPool with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteAgentPoolRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAgentPool(request), expectedError); + }); + }); + + describe('runTransferJob', () => { + it('invokes runTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.RunTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runTransferJob = stubLongRunningCall(expectedResponse); + const [operation] = await client.runTransferJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.RunTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runTransferJob = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runTransferJob( + 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.runTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes runTransferJob with call error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.RunTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runTransferJob = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runTransferJob(request), expectedError); + assert((client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runTransferJob with LRO error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.RunTransferJobRequest()); + request.jobName = ''; + const expectedHeaderRequestParams = "job_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runTransferJob = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runTransferJob(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRunTransferJobProgress without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + 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.checkRunTransferJobProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunTransferJobProgress with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + 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.checkRunTransferJobProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listTransferJobs', () => { + it('invokes listTransferJobs without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + ]; + client.innerApiCalls.listTransferJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listTransferJobs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTransferJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTransferJobs without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + ]; + client.innerApiCalls.listTransferJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTransferJobs( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTransferJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listTransferJobs with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.listTransferJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTransferJobs(request), expectedError); + assert((client.innerApiCalls.listTransferJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTransferJobsStream without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + ]; + client.descriptors.page.listTransferJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTransferJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.storagetransfer.v1.TransferJob[] = []; + stream.on('data', (response: protos.google.storagetransfer.v1.TransferJob) => { + 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.listTransferJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTransferJobs, request)); + }); + + it('invokes listTransferJobsStream with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); + const expectedError = new Error('expected'); + client.descriptors.page.listTransferJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTransferJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.storagetransfer.v1.TransferJob[] = []; + stream.on('data', (response: protos.google.storagetransfer.v1.TransferJob) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTransferJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTransferJobs, request)); + }); + + it('uses async iteration with listTransferJobs without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + ]; + client.descriptors.page.listTransferJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.storagetransfer.v1.ITransferJob[] = []; + const iterable = client.listTransferJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTransferJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + + it('uses async iteration with listTransferJobs with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest());const expectedError = new Error('expected'); + client.descriptors.page.listTransferJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTransferJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.storagetransfer.v1.ITransferJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTransferJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('listAgentPools', () => { + it('invokes listAgentPools without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + ]; + client.innerApiCalls.listAgentPools = stubSimpleCall(expectedResponse); + const [response] = await client.listAgentPools(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAgentPools as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAgentPools without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + ]; + client.innerApiCalls.listAgentPools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAgentPools( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAgentPools as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAgentPools with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAgentPools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAgentPools(request), expectedError); + assert((client.innerApiCalls.listAgentPools as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAgentPoolsStream without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + ]; + client.descriptors.page.listAgentPools.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAgentPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.storagetransfer.v1.AgentPool[] = []; + stream.on('data', (response: protos.google.storagetransfer.v1.AgentPool) => { + 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.listAgentPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAgentPools, request)); + assert.strictEqual( + (client.descriptors.page.listAgentPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAgentPoolsStream with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedError = new Error('expected'); + client.descriptors.page.listAgentPools.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAgentPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.storagetransfer.v1.AgentPool[] = []; + stream.on('data', (response: protos.google.storagetransfer.v1.AgentPool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAgentPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAgentPools, request)); + assert.strictEqual( + (client.descriptors.page.listAgentPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAgentPools without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id="; + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + ]; + client.descriptors.page.listAgentPools.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.storagetransfer.v1.IAgentPool[] = []; + const iterable = client.listAgentPoolsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAgentPools with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); + request.projectId = ''; + const expectedHeaderRequestParams = "project_id=";const expectedError = new Error('expected'); + client.descriptors.page.listAgentPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAgentPoolsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.storagetransfer.v1.IAgentPool[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('agentPools', () => { + const fakePath = "/rendered/path/agentPools"; + const expectedParameters = { + project_id: "projectIdValue", + agent_pool_id: "agentPoolIdValue", + }; + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPoolsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.agentPoolsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('agentPoolsPath', () => { + const result = client.agentPoolsPath("projectIdValue", "agentPoolIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.agentPoolsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectIdFromAgentPoolsName', () => { + const result = client.matchProjectIdFromAgentPoolsName(fakePath); + assert.strictEqual(result, "projectIdValue"); + assert((client.pathTemplates.agentPoolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAgentPoolIdFromAgentPoolsName', () => { + const result = client.matchAgentPoolIdFromAgentPoolsName(fakePath); + assert.strictEqual(result, "agentPoolIdValue"); + assert((client.pathTemplates.agentPoolsPathTemplate.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..08a3efc --- /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: 'StorageTransferService', + filename: './storage-transfer-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From fabdee5e7892f59136f3d325fb6d236458c9628b Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 9 Sep 2022 23:50:27 +0000 Subject: [PATCH 2/4] =?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 - .../google/storagetransfer/v1/transfer.proto | 387 --- .../storagetransfer/v1/transfer_types.proto | 1227 ---------- ...et_metadata.google.storagetransfer.v1.json | 631 ----- ...rage_transfer_service.create_agent_pool.js | 81 - ...ge_transfer_service.create_transfer_job.js | 61 - ...rage_transfer_service.delete_agent_pool.js | 61 - ...storage_transfer_service.get_agent_pool.js | 61 - ...sfer_service.get_google_service_account.js | 62 - ...orage_transfer_service.get_transfer_job.js | 67 - ...orage_transfer_service.list_agent_pools.js | 80 - ...age_transfer_service.list_transfer_jobs.js | 81 - ...ansfer_service.pause_transfer_operation.js | 61 - ...nsfer_service.resume_transfer_operation.js | 61 - ...orage_transfer_service.run_transfer_job.js | 68 - ...rage_transfer_service.update_agent_pool.js | 76 - ...ge_transfer_service.update_transfer_job.js | 94 - owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 171 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../src/v1/storage_transfer_service_client.ts | 1916 --------------- ...torage_transfer_service_client_config.json | 108 - .../storage_transfer_service_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../test/gapic_storage_transfer_service_v1.ts | 2080 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - .../google/storagetransfer/v1/transfer.proto | 20 +- .../storagetransfer/v1/transfer_types.proto | 122 +- protos/protos.d.ts | 402 +++- protos/protos.js | 1129 ++++++++- protos/protos.json | 126 +- ...et_metadata.google.storagetransfer.v1.json | 44 + ...ge_transfer_service.delete_transfer_job.js | 0 ...ge_transfer_service.update_transfer_job.js | 2 +- src/v1/gapic_metadata.json | 10 + src/v1/storage_transfer_service_client.ts | 275 ++- ...torage_transfer_service_client_config.json | 91 +- test/gapic_storage_transfer_service_v1.ts | 446 ++++ 49 files changed, 2565 insertions(+), 7990 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/storagetransfer/v1/transfer.proto delete mode 100644 owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js rename {owl-bot-staging/v1/samples => samples}/generated/v1/storage_transfer_service.delete_transfer_job.js (100%) 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 0ffbf58..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/storage-transfer', - 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 dc9f51c..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Storagetransfer: 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 791c0ac..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/storage-transfer", - "version": "0.1.0", - "description": "Storagetransfer client for Node.js", - "repository": "googleapis/nodejs-storagetransfer", - "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 storagetransfer", - "storagetransfer", - "storage transfer service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.3.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.56", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.0", - "linkinator": "^4.0.2", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.2", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto deleted file mode 100644 index 802cc10..0000000 --- a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto +++ /dev/null @@ -1,387 +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 -// -// 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.storagetransfer.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/storagetransfer/v1/transfer_types.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; -option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; -option java_outer_classname = "TransferProto"; -option java_package = "com.google.storagetransfer.v1.proto"; -option php_namespace = "Google\\Cloud\\StorageTransfer\\V1"; -option ruby_package = "Google::Cloud::StorageTransfer::V1"; - -// Storage Transfer Service and its protos. -// Transfers data between between Google Cloud Storage buckets or from a data -// source external to Google to a Cloud Storage bucket. -service StorageTransferService { - option (google.api.default_host) = "storagetransfer.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Returns the Google service account that is used by Storage Transfer - // Service to access buckets in the project where transfers - // run or in other projects. Each Google service account is associated - // with one Google Cloud project. Users - // should add this service account to the Google Cloud Storage bucket - // ACLs to grant access to Storage Transfer Service. This service - // account is created and owned by Storage Transfer Service and can - // only be used by Storage Transfer Service. - rpc GetGoogleServiceAccount(GetGoogleServiceAccountRequest) returns (GoogleServiceAccount) { - option (google.api.http) = { - get: "/v1/googleServiceAccounts/{project_id}" - }; - } - - // Creates a transfer job that runs periodically. - rpc CreateTransferJob(CreateTransferJobRequest) returns (TransferJob) { - option (google.api.http) = { - post: "/v1/transferJobs" - body: "transfer_job" - }; - } - - // Updates a transfer job. Updating a job's transfer spec does not affect - // transfer operations that are running already. - // - // **Note:** The job's [status][google.storagetransfer.v1.TransferJob.status] field can be modified - // using this RPC (for example, to set a job's status to - // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED], - // [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], or - // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]). - rpc UpdateTransferJob(UpdateTransferJobRequest) returns (TransferJob) { - option (google.api.http) = { - patch: "/v1/{job_name=transferJobs/**}" - body: "*" - }; - } - - // Gets a transfer job. - rpc GetTransferJob(GetTransferJobRequest) returns (TransferJob) { - option (google.api.http) = { - get: "/v1/{job_name=transferJobs/**}" - }; - } - - // Lists transfer jobs. - rpc ListTransferJobs(ListTransferJobsRequest) returns (ListTransferJobsResponse) { - option (google.api.http) = { - get: "/v1/transferJobs" - }; - } - - // Pauses a transfer operation. - rpc PauseTransferOperation(PauseTransferOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=transferOperations/**}:pause" - body: "*" - }; - } - - // Resumes a transfer operation that is paused. - rpc ResumeTransferOperation(ResumeTransferOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=transferOperations/**}:resume" - body: "*" - }; - } - - // Attempts to start a new TransferOperation for the current TransferJob. A - // TransferJob has a maximum of one active TransferOperation. If this method - // is called while a TransferOperation is active, an error will be returned. - rpc RunTransferJob(RunTransferJobRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{job_name=transferJobs/**}:run" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "TransferOperation" - }; - } - - // Deletes a transfer job. Deleting a transfer job sets its status to - // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. - rpc DeleteTransferJob(DeleteTransferJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{job_name=transferJobs/**}" - }; - } - - // Creates an agent pool resource. - rpc CreateAgentPool(CreateAgentPoolRequest) returns (AgentPool) { - option (google.api.http) = { - post: "/v1/projects/{project_id=*}/agentPools" - body: "agent_pool" - }; - option (google.api.method_signature) = "project_id,agent_pool,agent_pool_id"; - } - - // Updates an existing agent pool resource. - rpc UpdateAgentPool(UpdateAgentPoolRequest) returns (AgentPool) { - option (google.api.http) = { - patch: "/v1/{agent_pool.name=projects/*/agentPools/*}" - body: "agent_pool" - }; - option (google.api.method_signature) = "agent_pool,update_mask"; - } - - // Gets an agent pool. - rpc GetAgentPool(GetAgentPoolRequest) returns (AgentPool) { - option (google.api.http) = { - get: "/v1/{name=projects/*/agentPools/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists agent pools. - rpc ListAgentPools(ListAgentPoolsRequest) returns (ListAgentPoolsResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id=*}/agentPools" - }; - option (google.api.method_signature) = "project_id"; - } - - // Deletes an agent pool. - rpc DeleteAgentPool(DeleteAgentPoolRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/agentPools/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request passed to GetGoogleServiceAccount. -message GetGoogleServiceAccountRequest { - // Required. The ID of the Google Cloud project that the Google service - // account is associated with. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to CreateTransferJob. -message CreateTransferJobRequest { - // Required. The job to create. - TransferJob transfer_job = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to UpdateTransferJob. -message UpdateTransferJobRequest { - // Required. The name of job to update. - string job_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the Google Cloud project that owns the - // job. - string project_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The job to update. `transferJob` is expected to specify one or more of - // five fields: [description][google.storagetransfer.v1.TransferJob.description], - // [transfer_spec][google.storagetransfer.v1.TransferJob.transfer_spec], - // [notification_config][google.storagetransfer.v1.TransferJob.notification_config], - // [logging_config][google.storagetransfer.v1.TransferJob.logging_config], and - // [status][google.storagetransfer.v1.TransferJob.status]. An `UpdateTransferJobRequest` that specifies - // other fields are rejected with the error - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. Updating a job status - // to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED] requires - // `storagetransfer.jobs.delete` permission. - TransferJob transfer_job = 3 [(google.api.field_behavior) = REQUIRED]; - - // The field mask of the fields in `transferJob` that are to be updated in - // this request. Fields in `transferJob` that can be updated are: - // [description][google.storagetransfer.v1.TransferJob.description], - // [transfer_spec][google.storagetransfer.v1.TransferJob.transfer_spec], - // [notification_config][google.storagetransfer.v1.TransferJob.notification_config], - // [logging_config][google.storagetransfer.v1.TransferJob.logging_config], and - // [status][google.storagetransfer.v1.TransferJob.status]. To update the `transfer_spec` of the job, a - // complete transfer specification must be provided. An incomplete - // specification missing any required fields is rejected with the error - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. - google.protobuf.FieldMask update_transfer_job_field_mask = 4; -} - -// Request passed to GetTransferJob. -message GetTransferJobRequest { - // Required. The job to get. - string job_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the Google Cloud project that owns the - // job. - string project_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to DeleteTransferJob. -message DeleteTransferJobRequest { - // Required. The job to delete. - string job_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the Google Cloud project that owns the - // job. - string project_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// `projectId`, `jobNames`, and `jobStatuses` are query parameters that can -// be specified when listing transfer jobs. -message ListTransferJobsRequest { - // Required. A list of query parameters specified as JSON text in the form of: - // `{"projectId":"my_project_id", - // "jobNames":["jobid1","jobid2",...], - // "jobStatuses":["status1","status2",...]}` - // - // Since `jobNames` and `jobStatuses` support multiple values, their values - // must be specified with array notation. `projectId` is required. - // `jobNames` and `jobStatuses` are optional. The valid values for - // `jobStatuses` are case-insensitive: - // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED], - // [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], and - // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. - string filter = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list page size. The max allowed value is 256. - int32 page_size = 4; - - // The list page token. - string page_token = 5; -} - -// Response from ListTransferJobs. -message ListTransferJobsResponse { - // A list of transfer jobs. - repeated TransferJob transfer_jobs = 1; - - // The list next page token. - string next_page_token = 2; -} - -// Request passed to PauseTransferOperation. -message PauseTransferOperationRequest { - // Required. The name of the transfer operation. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to ResumeTransferOperation. -message ResumeTransferOperationRequest { - // Required. The name of the transfer operation. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to RunTransferJob. -message RunTransferJobRequest { - // Required. The name of the transfer job. - string job_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the Google Cloud project that owns the transfer - // job. - string project_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies the request passed to CreateAgentPool. -message CreateAgentPoolRequest { - // Required. The ID of the Google Cloud project that owns the - // agent pool. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The agent pool to create. - AgentPool agent_pool = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the agent pool to create. - // - // The `agent_pool_id` must meet the following requirements: - // - // * Length of 128 characters or less. - // * Not start with the string `goog`. - // * Start with a lowercase ASCII character, followed by: - // * Zero or more: lowercase Latin alphabet characters, numerals, - // hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). - // * One or more numerals or lowercase ASCII characters. - // - // As expressed by the regular expression: - // `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`. - string agent_pool_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies the request passed to UpdateAgentPool. -message UpdateAgentPoolRequest { - // Required. The agent pool to update. `agent_pool` is expected to specify following - // fields: - // - // * [name][google.storagetransfer.v1.AgentPool.name] - // - // * [display_name][google.storagetransfer.v1.AgentPool.display_name] - // - // * [bandwidth_limit][google.storagetransfer.v1.AgentPool.bandwidth_limit] - // An `UpdateAgentPoolRequest` with any other fields is rejected - // with the error [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. - AgentPool agent_pool = 1 [(google.api.field_behavior) = REQUIRED]; - - // The [field mask] - // (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) - // of the fields in `agentPool` to update in this request. - // The following `agentPool` fields can be updated: - // - // * [display_name][google.storagetransfer.v1.AgentPool.display_name] - // - // * [bandwidth_limit][google.storagetransfer.v1.AgentPool.bandwidth_limit] - google.protobuf.FieldMask update_mask = 2; -} - -// Specifies the request passed to GetAgentPool. -message GetAgentPoolRequest { - // Required. The name of the agent pool to get. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies the request passed to DeleteAgentPool. -message DeleteAgentPoolRequest { - // Required. The name of the agent pool to delete. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request passed to ListAgentPools. -message ListAgentPoolsRequest { - // Required. The ID of the Google Cloud project that owns the job. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // An optional list of query parameters specified as JSON text in the - // form of: - // - // `{"agentPoolNames":["agentpool1","agentpool2",...]}` - // - // Since `agentPoolNames` support multiple values, its values must be - // specified with array notation. When the filter is either empty or not - // provided, the list returns all agent pools for the project. - string filter = 2; - - // The list page size. The max allowed value is `256`. - int32 page_size = 3; - - // The list page token. - string page_token = 4; -} - -// Response from ListAgentPools. -message ListAgentPoolsResponse { - // A list of agent pools. - repeated AgentPool agent_pools = 1; - - // The list next page token. - string next_page_token = 2; -} diff --git a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto deleted file mode 100644 index 4e1a3b5..0000000 --- a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto +++ /dev/null @@ -1,1227 +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 -// -// 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.storagetransfer.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/code.proto"; -import "google/type/date.proto"; -import "google/type/timeofday.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; -option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; -option java_outer_classname = "TransferTypes"; -option java_package = "com.google.storagetransfer.v1.proto"; -option php_namespace = "Google\\Cloud\\StorageTransfer\\V1"; -option ruby_package = "Google::Cloud::StorageTransfer::V1"; - -// Google service account -message GoogleServiceAccount { - // Email address of the service account. - string account_email = 1; - - // Unique identifier for the service account. - string subject_id = 2; -} - -// AWS access key (see -// [AWS Security -// Credentials](https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)). -// -// For information on our data retention policy for user credentials, see -// [User credentials](/storage-transfer/docs/data-retention#user-credentials). -message AwsAccessKey { - // Required. AWS access key ID. - string access_key_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. AWS secret access key. This field is not returned in RPC - // responses. - string secret_access_key = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Azure credentials -// -// For information on our data retention policy for user credentials, see -// [User credentials](/storage-transfer/docs/data-retention#user-credentials). -message AzureCredentials { - // Required. Azure shared access signature (SAS). - // - // For more information about SAS, see - // [Grant limited access to Azure Storage resources using shared access - // signatures - // (SAS)](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview). - string sas_token = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Conditions that determine which objects are transferred. Applies only -// to Cloud Data Sources such as S3, Azure, and Cloud Storage. -// -// The "last modification time" refers to the time of the -// last change to the object's content or metadata — specifically, this is -// the `updated` property of Cloud Storage objects, the `LastModified` field -// of S3 objects, and the `Last-Modified` header of Azure blobs. -// -// Transfers with a [PosixFilesystem][google.storagetransfer.v1.PosixFilesystem] source or destination don't support -// `ObjectConditions`. -message ObjectConditions { - // Ensures that objects are not transferred until a specific minimum time - // has elapsed after the "last modification time". When a - // [TransferOperation][google.storagetransfer.v1.TransferOperation] begins, objects with a "last modification time" are - // transferred only if the elapsed time between the - // [start_time][google.storagetransfer.v1.TransferOperation.start_time] of the `TransferOperation` - // and the "last modification time" of the object is equal to or - // greater than the value of min_time_elapsed_since_last_modification`. - // Objects that do not have a "last modification time" are also transferred. - google.protobuf.Duration min_time_elapsed_since_last_modification = 1; - - // Ensures that objects are not transferred if a specific maximum time - // has elapsed since the "last modification time". - // When a [TransferOperation][google.storagetransfer.v1.TransferOperation] begins, objects with a - // "last modification time" are transferred only if the elapsed time - // between the [start_time][google.storagetransfer.v1.TransferOperation.start_time] of the - // `TransferOperation`and the "last modification time" of the object - // is less than the value of max_time_elapsed_since_last_modification`. - // Objects that do not have a "last modification time" are also transferred. - google.protobuf.Duration max_time_elapsed_since_last_modification = 2; - - // If you specify `include_prefixes`, Storage Transfer Service uses the items - // in the `include_prefixes` array to determine which objects to include in a - // transfer. Objects must start with one of the matching `include_prefixes` - // for inclusion in the transfer. If [exclude_prefixes][google.storagetransfer.v1.ObjectConditions.exclude_prefixes] is specified, - // objects must not start with any of the `exclude_prefixes` specified for - // inclusion in the transfer. - // - // The following are requirements of `include_prefixes`: - // - // * Each include-prefix can contain any sequence of Unicode characters, to - // a max length of 1024 bytes when UTF8-encoded, and must not contain - // Carriage Return or Line Feed characters. Wildcard matching and regular - // expression matching are not supported. - // - // * Each include-prefix must omit the leading slash. For example, to - // include the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, - // specify the include-prefix as `logs/y=2015/requests.gz`. - // - // * None of the include-prefix values can be empty, if specified. - // - // * Each include-prefix must include a distinct portion of the object - // namespace. No include-prefix may be a prefix of another - // include-prefix. - // - // The max size of `include_prefixes` is 1000. - // - // For more information, see [Filtering objects from - // transfers](/storage-transfer/docs/filtering-objects-from-transfers). - repeated string include_prefixes = 3; - - // If you specify `exclude_prefixes`, Storage Transfer Service uses the items - // in the `exclude_prefixes` array to determine which objects to exclude from - // a transfer. Objects must not start with one of the matching - // `exclude_prefixes` for inclusion in a transfer. - // - // The following are requirements of `exclude_prefixes`: - // - // * Each exclude-prefix can contain any sequence of Unicode characters, to - // a max length of 1024 bytes when UTF8-encoded, and must not contain - // Carriage Return or Line Feed characters. Wildcard matching and regular - // expression matching are not supported. - // - // * Each exclude-prefix must omit the leading slash. For example, to - // exclude the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, - // specify the exclude-prefix as `logs/y=2015/requests.gz`. - // - // * None of the exclude-prefix values can be empty, if specified. - // - // * Each exclude-prefix must exclude a distinct portion of the object - // namespace. No exclude-prefix may be a prefix of another - // exclude-prefix. - // - // * If [include_prefixes][google.storagetransfer.v1.ObjectConditions.include_prefixes] is specified, then each exclude-prefix must - // start with the value of a path explicitly included by `include_prefixes`. - // - // The max size of `exclude_prefixes` is 1000. - // - // For more information, see [Filtering objects from - // transfers](/storage-transfer/docs/filtering-objects-from-transfers). - repeated string exclude_prefixes = 4; - - // If specified, only objects with a "last modification time" on or after - // this timestamp and objects that don't have a "last modification time" are - // transferred. - // - // The `last_modified_since` and `last_modified_before` fields can be used - // together for chunked data processing. For example, consider a script that - // processes each day's worth of data at a time. For that you'd set each - // of the fields as follows: - // - // * `last_modified_since` to the start of the day - // - // * `last_modified_before` to the end of the day - google.protobuf.Timestamp last_modified_since = 5; - - // If specified, only objects with a "last modification time" before this - // timestamp and objects that don't have a "last modification time" are - // transferred. - google.protobuf.Timestamp last_modified_before = 6; -} - -// In a GcsData resource, an object's name is the Cloud Storage object's -// name and its "last modification time" refers to the object's `updated` -// property of Cloud Storage objects, which changes when the content or the -// metadata of the object is updated. -message GcsData { - // Required. Cloud Storage bucket name. Must meet - // [Bucket Name Requirements](/storage/docs/naming#requirements). - string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Root path to transfer objects. - // - // Must be an empty string or full path name that ends with a '/'. This field - // is treated as an object prefix. As such, it should generally not begin with - // a '/'. - // - // The root path value must meet - // [Object Name Requirements](/storage/docs/naming#objectnames). - string path = 3; -} - -// An AwsS3Data resource can be a data source, but not a data sink. -// In an AwsS3Data resource, an object's name is the S3 object's key name. -message AwsS3Data { - // Required. S3 Bucket name (see - // [Creating a - // bucket](https://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-get-location-example.html)). - string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Input only. AWS access key used to sign the API requests to the AWS S3 bucket. - // Permissions on the bucket must be granted to the access ID of the AWS - // access key. - // - // For information on our data retention policy for user credentials, see - // [User credentials](/storage-transfer/docs/data-retention#user-credentials). - AwsAccessKey aws_access_key = 2 [(google.api.field_behavior) = INPUT_ONLY]; - - // Root path to transfer objects. - // - // Must be an empty string or full path name that ends with a '/'. This field - // is treated as an object prefix. As such, it should generally not begin with - // a '/'. - string path = 3; - - // The Amazon Resource Name (ARN) of the role to support temporary - // credentials via `AssumeRoleWithWebIdentity`. For more information about - // ARNs, see [IAM - // ARNs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns). - // - // When a role ARN is provided, Transfer Service fetches temporary - // credentials for the session using a `AssumeRoleWithWebIdentity` call for - // the provided role using the [GoogleServiceAccount][google.storagetransfer.v1.GoogleServiceAccount] for this project. - string role_arn = 4; -} - -// An AzureBlobStorageData resource can be a data source, but not a data sink. -// An AzureBlobStorageData resource represents one Azure container. The storage -// account determines the [Azure -// endpoint](https://docs.microsoft.com/en-us/azure/storage/common/storage-create-storage-account#storage-account-endpoints). -// In an AzureBlobStorageData resource, a blobs's name is the [Azure Blob -// Storage blob's key -// name](https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#blob-names). -message AzureBlobStorageData { - // Required. The name of the Azure Storage account. - string storage_account = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. Credentials used to authenticate API requests to Azure. - // - // For information on our data retention policy for user credentials, see - // [User credentials](/storage-transfer/docs/data-retention#user-credentials). - AzureCredentials azure_credentials = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - - // Required. The container to transfer from the Azure Storage account. - string container = 4 [(google.api.field_behavior) = REQUIRED]; - - // Root path to transfer objects. - // - // Must be an empty string or full path name that ends with a '/'. This field - // is treated as an object prefix. As such, it should generally not begin with - // a '/'. - string path = 5; -} - -// An HttpData resource specifies a list of objects on the web to be transferred -// over HTTP. The information of the objects to be transferred is contained in -// a file referenced by a URL. The first line in the file must be -// `"TsvHttpData-1.0"`, which specifies the format of the file. Subsequent -// lines specify the information of the list of objects, one object per list -// entry. Each entry has the following tab-delimited fields: -// -// * **HTTP URL** — The location of the object. -// -// * **Length** — The size of the object in bytes. -// -// * **MD5** — The base64-encoded MD5 hash of the object. -// -// For an example of a valid TSV file, see -// [Transferring data from -// URLs](https://cloud.google.com/storage-transfer/docs/create-url-list). -// -// When transferring data based on a URL list, keep the following in mind: -// -// * When an object located at `http(s)://hostname:port/` is -// transferred to a data sink, the name of the object at the data sink is -// `/`. -// -// * If the specified size of an object does not match the actual size of the -// object fetched, the object is not transferred. -// -// * If the specified MD5 does not match the MD5 computed from the transferred -// bytes, the object transfer fails. -// -// * Ensure that each URL you specify is publicly accessible. For -// example, in Cloud Storage you can -// [share an object publicly] -// (/storage/docs/cloud-console#_sharingdata) and get a link to it. -// -// * Storage Transfer Service obeys `robots.txt` rules and requires the source -// HTTP server to support `Range` requests and to return a `Content-Length` -// header in each response. -// -// * [ObjectConditions][google.storagetransfer.v1.ObjectConditions] have no effect when filtering objects to transfer. -message HttpData { - // Required. The URL that points to the file that stores the object list - // entries. This file must allow public access. Currently, only URLs with - // HTTP and HTTPS schemes are supported. - string list_url = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// A POSIX filesystem resource. -message PosixFilesystem { - // Root directory path to the filesystem. - string root_directory = 1; -} - -// An AwsS3CompatibleData resource. -message AwsS3CompatibleData { - // Required. Specifies the name of the bucket. - string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Specifies the root path to transfer objects. - // - // Must be an empty string or full path name that ends with a '/'. This - // field is treated as an object prefix. As such, it should generally not - // begin with a '/'. - string path = 2; - - // Required. Specifies the endpoint of the storage service. - string endpoint = 3 [(google.api.field_behavior) = REQUIRED]; - - // Specifies the region to sign requests with. This can be left blank if - // requests should be signed with an empty region. - string region = 5; - - // Specifies the metadata of the S3 compatible data provider. Each provider - // may contain some attributes that do not apply to all S3-compatible data - // providers. When not specified, S3CompatibleMetadata is used by default. - oneof data_provider { - // A S3 compatible metadata. - S3CompatibleMetadata s3_metadata = 4; - } -} - -// S3CompatibleMetadata contains the metadata fields that apply to the basic -// types of S3-compatible data providers. -message S3CompatibleMetadata { - // The authentication and authorization method used by the storage service. - enum AuthMethod { - // AuthMethod is not specified. - AUTH_METHOD_UNSPECIFIED = 0; - - // Auth requests with AWS SigV4. - AUTH_METHOD_AWS_SIGNATURE_V4 = 1; - - // Auth requests with AWS SigV2. - AUTH_METHOD_AWS_SIGNATURE_V2 = 2; - } - - // The request model of the API. - enum RequestModel { - // RequestModel is not specified. - REQUEST_MODEL_UNSPECIFIED = 0; - - // Perform requests using Virtual Hosted Style. - // Example: https://bucket-name.s3.region.amazonaws.com/key-name - REQUEST_MODEL_VIRTUAL_HOSTED_STYLE = 1; - - // Perform requests using Path Style. - // Example: https://s3.region.amazonaws.com/bucket-name/key-name - REQUEST_MODEL_PATH_STYLE = 2; - } - - // The agent network protocol to access the storage service. - enum NetworkProtocol { - // NetworkProtocol is not specified. - NETWORK_PROTOCOL_UNSPECIFIED = 0; - - // Perform requests using HTTPS. - NETWORK_PROTOCOL_HTTPS = 1; - - // Not recommended: This sends data in clear-text. This is only - // appropriate within a closed network or for publicly available data. - // Perform requests using HTTP. - NETWORK_PROTOCOL_HTTP = 2; - } - - // The Listing API to use for discovering objects. - enum ListApi { - // ListApi is not specified. - LIST_API_UNSPECIFIED = 0; - - // Perform listing using ListObjectsV2 API. - LIST_OBJECTS_V2 = 1; - - // Legacy ListObjects API. - LIST_OBJECTS = 2; - } - - // Specifies the authentication and authorization method used by the storage - // service. When not specified, Transfer Service will attempt to determine - // right auth method to use. - AuthMethod auth_method = 1; - - // Specifies the API request model used to call the storage service. When not - // specified, the default value of RequestModel - // REQUEST_MODEL_VIRTUAL_HOSTED_STYLE is used. - RequestModel request_model = 2; - - // Specifies the network protocol of the agent. When not specified, the - // default value of NetworkProtocol NETWORK_PROTOCOL_HTTPS is used. - NetworkProtocol protocol = 3; - - // The Listing API to use for discovering objects. When not specified, - // Transfer Service will attempt to determine the right API to use. - ListApi list_api = 4; -} - -// Represents an On-Premises Agent pool. -message AgentPool { - option (google.api.resource) = { - type: "storagetransfer.googleapis.com/agentPools" - pattern: "projects/{project_id}/agentPools/{agent_pool_id}" - }; - - // The state of an AgentPool. - enum State { - // Default value. This value is unused. - STATE_UNSPECIFIED = 0; - - // This is an initialization state. During this stage, the resources such as - // Pub/Sub topics are allocated for the AgentPool. - CREATING = 1; - - // Determines that the AgentPool is created for use. At this state, Agents - // can join the AgentPool and participate in the transfer jobs in that pool. - CREATED = 2; - - // Determines that the AgentPool deletion has been initiated, and all the - // resources are scheduled to be cleaned up and freed. - DELETING = 3; - } - - // Specifies a bandwidth limit for an agent pool. - message BandwidthLimit { - // Bandwidth rate in megabytes per second, distributed across all the agents - // in the pool. - int64 limit_mbps = 1; - } - - // Required. Specifies a unique string that identifies the agent pool. - // - // Format: `projects/{project_id}/agentPools/{agent_pool_id}` - string name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Specifies the client-specified AgentPool description. - string display_name = 3; - - // Output only. Specifies the state of the AgentPool. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Specifies the bandwidth limit details. If this field is unspecified, the - // default value is set as 'No Limit'. - BandwidthLimit bandwidth_limit = 5; -} - -// TransferOptions define the actions to be performed on objects in a transfer. -message TransferOptions { - // Specifies when to overwrite an object in the sink when an object with - // matching name is found in the source. - enum OverwriteWhen { - // Overwrite behavior is unspecified. - OVERWRITE_WHEN_UNSPECIFIED = 0; - - // Overwrites destination objects with the source objects, only if the - // objects have the same name but different HTTP ETags or checksum values. - DIFFERENT = 1; - - // Never overwrites a destination object if a source object has the - // same name. In this case, the source object is not transferred. - NEVER = 2; - - // Always overwrite the destination object with the source object, even if - // the HTTP Etags or checksum values are the same. - ALWAYS = 3; - } - - // When to overwrite objects that already exist in the sink. The default is - // that only objects that are different from the source are ovewritten. If - // true, all objects in the sink whose name matches an object in the source - // are overwritten with the source object. - bool overwrite_objects_already_existing_in_sink = 1; - - // Whether objects that exist only in the sink should be deleted. - // - // **Note:** This option and [delete_objects_from_source_after_transfer][google.storagetransfer.v1.TransferOptions.delete_objects_from_source_after_transfer] are - // mutually exclusive. - bool delete_objects_unique_in_sink = 2; - - // Whether objects should be deleted from the source after they are - // transferred to the sink. - // - // **Note:** This option and [delete_objects_unique_in_sink][google.storagetransfer.v1.TransferOptions.delete_objects_unique_in_sink] are mutually - // exclusive. - bool delete_objects_from_source_after_transfer = 3; - - // When to overwrite objects that already exist in the sink. If not set, - // overwrite behavior is determined by - // [overwrite_objects_already_existing_in_sink][google.storagetransfer.v1.TransferOptions.overwrite_objects_already_existing_in_sink]. - OverwriteWhen overwrite_when = 4; - - // Represents the selected metadata options for a transfer job. - MetadataOptions metadata_options = 5; -} - -// Configuration for running a transfer. -message TransferSpec { - // The write sink for the data. - oneof data_sink { - // A Cloud Storage data sink. - GcsData gcs_data_sink = 4; - - // A POSIX Filesystem data sink. - PosixFilesystem posix_data_sink = 13; - } - - // The read source of the data. - oneof data_source { - // A Cloud Storage data source. - GcsData gcs_data_source = 1; - - // An AWS S3 data source. - AwsS3Data aws_s3_data_source = 2; - - // An HTTP URL data source. - HttpData http_data_source = 3; - - // A POSIX Filesystem data source. - PosixFilesystem posix_data_source = 14; - - // An Azure Blob Storage data source. - AzureBlobStorageData azure_blob_storage_data_source = 8; - - // An AWS S3 compatible data source. - AwsS3CompatibleData aws_s3_compatible_data_source = 19; - } - - // Represents a supported data container type which is required for transfer - // jobs which needs a data source, a data sink and an intermediate location to - // transfer data through. This is validated on TransferJob creation. - oneof intermediate_data_location { - // Cloud Storage intermediate data location. - GcsData gcs_intermediate_data_location = 16; - } - - // Only objects that satisfy these object conditions are included in the set - // of data source and data sink objects. Object conditions based on - // objects' "last modification time" do not exclude objects in a data sink. - ObjectConditions object_conditions = 5; - - // If the option - // [delete_objects_unique_in_sink][google.storagetransfer.v1.TransferOptions.delete_objects_unique_in_sink] - // is `true` and time-based object conditions such as 'last modification time' - // are specified, the request fails with an - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. - TransferOptions transfer_options = 6; - - // A manifest file provides a list of objects to be transferred from the data - // source. This field points to the location of the manifest file. - // Otherwise, the entire source bucket is used. ObjectConditions still apply. - TransferManifest transfer_manifest = 15; - - // Specifies the agent pool name associated with the posix data source. When - // unspecified, the default name is used. - string source_agent_pool_name = 17; - - // Specifies the agent pool name associated with the posix data sink. When - // unspecified, the default name is used. - string sink_agent_pool_name = 18; -} - -// Specifies the metadata options for running a transfer. -message MetadataOptions { - // Whether symlinks should be skipped or preserved during a transfer job. - enum Symlink { - // Symlink behavior is unspecified. - SYMLINK_UNSPECIFIED = 0; - - // Do not preserve symlinks during a transfer job. - SYMLINK_SKIP = 1; - - // Preserve symlinks during a transfer job. - SYMLINK_PRESERVE = 2; - } - - // Options for handling file mode attribute. - enum Mode { - // Mode behavior is unspecified. - MODE_UNSPECIFIED = 0; - - // Do not preserve mode during a transfer job. - MODE_SKIP = 1; - - // Preserve mode during a transfer job. - MODE_PRESERVE = 2; - } - - // Options for handling file GID attribute. - enum GID { - // GID behavior is unspecified. - GID_UNSPECIFIED = 0; - - // Do not preserve GID during a transfer job. - GID_SKIP = 1; - - // Preserve GID during a transfer job. - GID_NUMBER = 2; - } - - // Options for handling file UID attribute. - enum UID { - // UID behavior is unspecified. - UID_UNSPECIFIED = 0; - - // Do not preserve UID during a transfer job. - UID_SKIP = 1; - - // Preserve UID during a transfer job. - UID_NUMBER = 2; - } - - // Options for handling Cloud Storage object ACLs. - enum Acl { - // ACL behavior is unspecified. - ACL_UNSPECIFIED = 0; - - // Use the destination bucket's default object ACLS, if applicable. - ACL_DESTINATION_BUCKET_DEFAULT = 1; - - // Preserve the object's original ACLs. This requires the service account - // to have `storage.objects.getIamPolicy` permission for the source object. - // [Uniform bucket-level - // access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) - // must not be enabled on either the source or destination buckets. - ACL_PRESERVE = 2; - } - - // Options for handling Google Cloud Storage object storage class. - enum StorageClass { - // Storage class behavior is unspecified. - STORAGE_CLASS_UNSPECIFIED = 0; - - // Use the destination bucket's default storage class. - STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT = 1; - - // Preserve the object's original storage class. This is only supported for - // transfers from Google Cloud Storage buckets. - STORAGE_CLASS_PRESERVE = 2; - - // Set the storage class to STANDARD. - STORAGE_CLASS_STANDARD = 3; - - // Set the storage class to NEARLINE. - STORAGE_CLASS_NEARLINE = 4; - - // Set the storage class to COLDLINE. - STORAGE_CLASS_COLDLINE = 5; - - // Set the storage class to ARCHIVE. - STORAGE_CLASS_ARCHIVE = 6; - } - - // Options for handling temporary holds for Google Cloud Storage objects. - enum TemporaryHold { - // Temporary hold behavior is unspecified. - TEMPORARY_HOLD_UNSPECIFIED = 0; - - // Do not set a temporary hold on the destination object. - TEMPORARY_HOLD_SKIP = 1; - - // Preserve the object's original temporary hold status. - TEMPORARY_HOLD_PRESERVE = 2; - } - - // Options for handling the KmsKey setting for Google Cloud Storage objects. - enum KmsKey { - // KmsKey behavior is unspecified. - KMS_KEY_UNSPECIFIED = 0; - - // Use the destination bucket's default encryption settings. - KMS_KEY_DESTINATION_BUCKET_DEFAULT = 1; - - // Preserve the object's original Cloud KMS customer-managed encryption key - // (CMEK) if present. Objects that do not use a Cloud KMS encryption key - // will be encrypted using the destination bucket's encryption settings. - KMS_KEY_PRESERVE = 2; - } - - // Options for handling `timeCreated` metadata for Google Cloud Storage - // objects. - enum TimeCreated { - // TimeCreated behavior is unspecified. - TIME_CREATED_UNSPECIFIED = 0; - - // Do not preserve the `timeCreated` metadata from the source object. - TIME_CREATED_SKIP = 1; - - // Preserves the source object's `timeCreated` metadata in the `customTime` - // field in the destination object. Note that any value stored in the - // source object's `customTime` field will not be propagated to the - // destination object. - TIME_CREATED_PRESERVE_AS_CUSTOM_TIME = 2; - } - - // Specifies how symlinks should be handled by the transfer. By default, - // symlinks are not preserved. Only applicable to transfers involving - // POSIX file systems, and ignored for other transfers. - Symlink symlink = 1; - - // Specifies how each file's mode attribute should be handled by the transfer. - // By default, mode is not preserved. Only applicable to transfers involving - // POSIX file systems, and ignored for other transfers. - Mode mode = 2; - - // Specifies how each file's POSIX group ID (GID) attribute should be handled - // by the transfer. By default, GID is not preserved. Only applicable to - // transfers involving POSIX file systems, and ignored for other transfers. - GID gid = 3; - - // Specifies how each file's POSIX user ID (UID) attribute should be handled - // by the transfer. By default, UID is not preserved. Only applicable to - // transfers involving POSIX file systems, and ignored for other transfers. - UID uid = 4; - - // Specifies how each object's ACLs should be preserved for transfers between - // Google Cloud Storage buckets. If unspecified, the default behavior is the - // same as ACL_DESTINATION_BUCKET_DEFAULT. - Acl acl = 5; - - // Specifies the storage class to set on objects being transferred to Google - // Cloud Storage buckets. If unspecified, the default behavior is the same as - // [STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT][google.storagetransfer.v1.MetadataOptions.StorageClass.STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT]. - StorageClass storage_class = 6; - - // Specifies how each object's temporary hold status should be preserved for - // transfers between Google Cloud Storage buckets. If unspecified, the - // default behavior is the same as - // [TEMPORARY_HOLD_PRESERVE][google.storagetransfer.v1.MetadataOptions.TemporaryHold.TEMPORARY_HOLD_PRESERVE]. - TemporaryHold temporary_hold = 7; - - // Specifies how each object's Cloud KMS customer-managed encryption key - // (CMEK) is preserved for transfers between Google Cloud Storage buckets. If - // unspecified, the default behavior is the same as - // [KMS_KEY_DESTINATION_BUCKET_DEFAULT][google.storagetransfer.v1.MetadataOptions.KmsKey.KMS_KEY_DESTINATION_BUCKET_DEFAULT]. - KmsKey kms_key = 8; - - // Specifies how each object's `timeCreated` metadata is preserved for - // transfers between Google Cloud Storage buckets. If unspecified, the - // default behavior is the same as - // [TIME_CREATED_SKIP][google.storagetransfer.v1.MetadataOptions.TimeCreated.TIME_CREATED_SKIP]. - TimeCreated time_created = 9; -} - -// Specifies where the manifest is located. -message TransferManifest { - // Specifies the path to the manifest in Cloud Storage. The Google-managed - // service account for the transfer must have `storage.objects.get` - // permission for this object. An example path is - // `gs://bucket_name/path/manifest.csv`. - string location = 1; -} - -// Transfers can be scheduled to recur or to run just once. -message Schedule { - // Required. The start date of a transfer. Date boundaries are determined - // relative to UTC time. If `schedule_start_date` and [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day] - // are in the past relative to the job's creation time, the transfer starts - // the day after you schedule the transfer request. - // - // **Note:** When starting jobs at or near midnight UTC it is possible that - // a job starts later than expected. For example, if you send an outbound - // request on June 1 one millisecond prior to midnight UTC and the Storage - // Transfer Service server receives the request on June 2, then it creates - // a TransferJob with `schedule_start_date` set to June 2 and a - // `start_time_of_day` set to midnight UTC. The first scheduled - // [TransferOperation][google.storagetransfer.v1.TransferOperation] takes place on June 3 at midnight UTC. - google.type.Date schedule_start_date = 1 [(google.api.field_behavior) = REQUIRED]; - - // The last day a transfer runs. Date boundaries are determined relative to - // UTC time. A job runs once per 24 hours within the following guidelines: - // - // * If `schedule_end_date` and [schedule_start_date][google.storagetransfer.v1.Schedule.schedule_start_date] are the same and in - // the future relative to UTC, the transfer is executed only one time. - // * If `schedule_end_date` is later than `schedule_start_date` and - // `schedule_end_date` is in the future relative to UTC, the job runs each - // day at [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day] through `schedule_end_date`. - google.type.Date schedule_end_date = 2; - - // The time in UTC that a transfer job is scheduled to run. Transfers may - // start later than this time. - // - // If `start_time_of_day` is not specified: - // - // * One-time transfers run immediately. - // * Recurring transfers run immediately, and each day at midnight UTC, - // through [schedule_end_date][google.storagetransfer.v1.Schedule.schedule_end_date]. - // - // If `start_time_of_day` is specified: - // - // * One-time transfers run at the specified time. - // * Recurring transfers run at the specified time each day, through - // `schedule_end_date`. - google.type.TimeOfDay start_time_of_day = 3; - - // The time in UTC that no further transfer operations are scheduled. Combined - // with [schedule_end_date][google.storagetransfer.v1.Schedule.schedule_end_date], `end_time_of_day` specifies the end date and - // time for starting new transfer operations. This field must be greater than - // or equal to the timestamp corresponding to the combintation of - // [schedule_start_date][google.storagetransfer.v1.Schedule.schedule_start_date] and [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day], and is subject to the - // following: - // - // * If `end_time_of_day` is not set and `schedule_end_date` is set, then - // a default value of `23:59:59` is used for `end_time_of_day`. - // - // * If `end_time_of_day` is set and `schedule_end_date` is not set, then - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] is returned. - google.type.TimeOfDay end_time_of_day = 4; - - // Interval between the start of each scheduled TransferOperation. If - // unspecified, the default value is 24 hours. This value may not be less than - // 1 hour. - google.protobuf.Duration repeat_interval = 5; -} - -// This resource represents the configuration of a transfer job that runs -// periodically. -message TransferJob { - // The status of the transfer job. - enum Status { - // Zero is an illegal value. - STATUS_UNSPECIFIED = 0; - - // New transfers are performed based on the schedule. - ENABLED = 1; - - // New transfers are not scheduled. - DISABLED = 2; - - // This is a soft delete state. After a transfer job is set to this - // state, the job and all the transfer executions are subject to - // garbage collection. Transfer jobs become eligible for garbage collection - // 30 days after their status is set to `DELETED`. - DELETED = 3; - } - - // A unique name (within the transfer project) assigned when the job is - // created. If this field is empty in a CreateTransferJobRequest, Storage - // Transfer Service assigns a unique name. Otherwise, the specified name - // is used as the unique name for this job. - // - // If the specified name is in use by a job, the creation request fails with - // an [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. - // - // This name must start with `"transferJobs/"` prefix and end with a letter or - // a number, and should be no more than 128 characters. For transfers - // involving PosixFilesystem, this name must start with `transferJobs/OPI` - // specifically. For all other transfer types, this name must not start with - // `transferJobs/OPI`. - // - // Non-PosixFilesystem example: - // `"transferJobs/^(?!OPI)[A-Za-z0-9-._~]*[A-Za-z0-9]$"` - // - // PosixFilesystem example: - // `"transferJobs/OPI^[A-Za-z0-9-._~]*[A-Za-z0-9]$"` - // - // Applications must not rely on the enforcement of naming requirements - // involving OPI. - // - // Invalid job names fail with an - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. - string name = 1; - - // A description provided by the user for the job. Its max length is 1024 - // bytes when Unicode-encoded. - string description = 2; - - // The ID of the Google Cloud project that owns the job. - string project_id = 3; - - // Transfer specification. - TransferSpec transfer_spec = 4; - - // Notification configuration. This is not supported for transfers involving - // PosixFilesystem. - NotificationConfig notification_config = 11; - - // Logging configuration. - LoggingConfig logging_config = 14; - - // Specifies schedule for the transfer job. - // This is an optional field. When the field is not set, the job never - // executes a transfer, unless you invoke RunTransferJob or update the job to - // have a non-empty schedule. - Schedule schedule = 5; - - // Status of the job. This value MUST be specified for - // `CreateTransferJobRequests`. - // - // **Note:** The effect of the new job status takes place during a subsequent - // job run. For example, if you change the job status from - // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED] to [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], and an operation - // spawned by the transfer is running, the status change would not affect the - // current operation. - Status status = 6; - - // Output only. The time that the transfer job was created. - google.protobuf.Timestamp creation_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time that the transfer job was last modified. - google.protobuf.Timestamp last_modification_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time that the transfer job was deleted. - google.protobuf.Timestamp deletion_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The name of the most recently started TransferOperation of this JobConfig. - // Present if a TransferOperation has been created for this JobConfig. - string latest_operation_name = 12; -} - -// An entry describing an error that has occurred. -message ErrorLogEntry { - // Required. A URL that refers to the target (a data source, a data sink, - // or an object) with which the error is associated. - string url = 1 [(google.api.field_behavior) = REQUIRED]; - - // A list of messages that carry the error details. - repeated string error_details = 3; -} - -// A summary of errors by error code, plus a count and sample error log -// entries. -message ErrorSummary { - // Required. - google.rpc.Code error_code = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Count of this type of error. - int64 error_count = 2 [(google.api.field_behavior) = REQUIRED]; - - // Error samples. - // - // At most 5 error log entries are recorded for a given - // error code for a single transfer operation. - repeated ErrorLogEntry error_log_entries = 3; -} - -// A collection of counters that report the progress of a transfer operation. -message TransferCounters { - // Objects found in the data source that are scheduled to be transferred, - // excluding any that are filtered based on object conditions or skipped due - // to sync. - int64 objects_found_from_source = 1; - - // Bytes found in the data source that are scheduled to be transferred, - // excluding any that are filtered based on object conditions or skipped due - // to sync. - int64 bytes_found_from_source = 2; - - // Objects found only in the data sink that are scheduled to be deleted. - int64 objects_found_only_from_sink = 3; - - // Bytes found only in the data sink that are scheduled to be deleted. - int64 bytes_found_only_from_sink = 4; - - // Objects in the data source that are not transferred because they already - // exist in the data sink. - int64 objects_from_source_skipped_by_sync = 5; - - // Bytes in the data source that are not transferred because they already - // exist in the data sink. - int64 bytes_from_source_skipped_by_sync = 6; - - // Objects that are copied to the data sink. - int64 objects_copied_to_sink = 7; - - // Bytes that are copied to the data sink. - int64 bytes_copied_to_sink = 8; - - // Objects that are deleted from the data source. - int64 objects_deleted_from_source = 9; - - // Bytes that are deleted from the data source. - int64 bytes_deleted_from_source = 10; - - // Objects that are deleted from the data sink. - int64 objects_deleted_from_sink = 11; - - // Bytes that are deleted from the data sink. - int64 bytes_deleted_from_sink = 12; - - // Objects in the data source that failed to be transferred or that failed - // to be deleted after being transferred. - int64 objects_from_source_failed = 13; - - // Bytes in the data source that failed to be transferred or that failed to - // be deleted after being transferred. - int64 bytes_from_source_failed = 14; - - // Objects that failed to be deleted from the data sink. - int64 objects_failed_to_delete_from_sink = 15; - - // Bytes that failed to be deleted from the data sink. - int64 bytes_failed_to_delete_from_sink = 16; - - // For transfers involving PosixFilesystem only. - // - // Number of directories found while listing. For example, if the root - // directory of the transfer is `base/` and there are two other directories, - // `a/` and `b/` under this directory, the count after listing `base/`, - // `base/a/` and `base/b/` is 3. - int64 directories_found_from_source = 17; - - // For transfers involving PosixFilesystem only. - // - // Number of listing failures for each directory found at the source. - // Potential failures when listing a directory include permission failure or - // block failure. If listing a directory fails, no files in the directory are - // transferred. - int64 directories_failed_to_list_from_source = 18; - - // For transfers involving PosixFilesystem only. - // - // Number of successful listings for each directory found at the source. - int64 directories_successfully_listed_from_source = 19; - - // Number of successfully cleaned up intermediate objects. - int64 intermediate_objects_cleaned_up = 22; - - // Number of intermediate objects failed cleaned up. - int64 intermediate_objects_failed_cleaned_up = 23; -} - -// Specification to configure notifications published to Pub/Sub. -// Notifications are published to the customer-provided topic using the -// following `PubsubMessage.attributes`: -// -// * `"eventType"`: one of the [EventType][google.storagetransfer.v1.NotificationConfig.EventType] values -// * `"payloadFormat"`: one of the [PayloadFormat][google.storagetransfer.v1.NotificationConfig.PayloadFormat] values -// * `"projectId"`: the [project_id][google.storagetransfer.v1.TransferOperation.project_id] of the -// `TransferOperation` -// * `"transferJobName"`: the -// [transfer_job_name][google.storagetransfer.v1.TransferOperation.transfer_job_name] of the -// `TransferOperation` -// * `"transferOperationName"`: the [name][google.storagetransfer.v1.TransferOperation.name] of the -// `TransferOperation` -// -// The `PubsubMessage.data` contains a [TransferOperation][google.storagetransfer.v1.TransferOperation] resource -// formatted according to the specified `PayloadFormat`. -message NotificationConfig { - // Enum for specifying event types for which notifications are to be - // published. - // - // Additional event types may be added in the future. Clients should either - // safely ignore unrecognized event types or explicitly specify which event - // types they are prepared to accept. - enum EventType { - // Illegal value, to avoid allowing a default. - EVENT_TYPE_UNSPECIFIED = 0; - - // `TransferOperation` completed with status - // [SUCCESS][google.storagetransfer.v1.TransferOperation.Status.SUCCESS]. - TRANSFER_OPERATION_SUCCESS = 1; - - // `TransferOperation` completed with status - // [FAILED][google.storagetransfer.v1.TransferOperation.Status.FAILED]. - TRANSFER_OPERATION_FAILED = 2; - - // `TransferOperation` completed with status - // [ABORTED][google.storagetransfer.v1.TransferOperation.Status.ABORTED]. - TRANSFER_OPERATION_ABORTED = 3; - } - - // Enum for specifying the format of a notification message's payload. - enum PayloadFormat { - // Illegal value, to avoid allowing a default. - PAYLOAD_FORMAT_UNSPECIFIED = 0; - - // No payload is included with the notification. - NONE = 1; - - // `TransferOperation` is [formatted as a JSON - // response](https://developers.google.com/protocol-buffers/docs/proto3#json), - // in application/json. - JSON = 2; - } - - // Required. The `Topic.name` of the Pub/Sub topic to which to publish - // notifications. Must be of the format: `projects/{project}/topics/{topic}`. - // Not matching this format results in an - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. - string pubsub_topic = 1 [(google.api.field_behavior) = REQUIRED]; - - // Event types for which a notification is desired. If empty, send - // notifications for all event types. - repeated EventType event_types = 2; - - // Required. The desired format of the notification message payloads. - PayloadFormat payload_format = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies the logging behavior for transfer operations. -// -// For cloud-to-cloud transfers, logs are sent to Cloud Logging. See -// [Read transfer -// logs](https://cloud.google.com/storage-transfer/docs/read-transfer-logs) for -// details. -// -// For transfers to or from a POSIX file system, logs are stored in the -// Cloud Storage bucket that is the source or sink of the transfer. -// See [Managing Transfer for on-premises jobs] -// (https://cloud.google.com/storage-transfer/docs/managing-on-prem-jobs#viewing-logs) -// for details. -message LoggingConfig { - // Loggable actions. - enum LoggableAction { - // Default value. This value is unused. - LOGGABLE_ACTION_UNSPECIFIED = 0; - - // Listing objects in a bucket. - FIND = 1; - - // Deleting objects at the source or the destination. - DELETE = 2; - - // Copying objects to Google Cloud Storage. - COPY = 3; - } - - // Loggable action states. - enum LoggableActionState { - // Default value. This value is unused. - LOGGABLE_ACTION_STATE_UNSPECIFIED = 0; - - // `LoggableAction` completed successfully. `SUCCEEDED` actions are - // logged as [INFO][google.logging.type.LogSeverity.INFO]. - SUCCEEDED = 1; - - // `LoggableAction` terminated in an error state. `FAILED` actions are - // logged as [ERROR][google.logging.type.LogSeverity.ERROR]. - FAILED = 2; - } - - // Specifies the actions to be logged. If empty, no logs are generated. - // Not supported for transfers with PosixFilesystem data sources; use - // [enable_onprem_gcs_transfer_logs][google.storagetransfer.v1.LoggingConfig.enable_onprem_gcs_transfer_logs] instead. - repeated LoggableAction log_actions = 1; - - // States in which `log_actions` are logged. If empty, no logs are generated. - // Not supported for transfers with PosixFilesystem data sources; use - // [enable_onprem_gcs_transfer_logs][google.storagetransfer.v1.LoggingConfig.enable_onprem_gcs_transfer_logs] instead. - repeated LoggableActionState log_action_states = 2; - - // For transfers with a PosixFilesystem source, this option enables the Cloud - // Storage transfer logs for this transfer. - bool enable_onprem_gcs_transfer_logs = 3; -} - -// A description of the execution of a transfer. -message TransferOperation { - // The status of a TransferOperation. - enum Status { - // Zero is an illegal value. - STATUS_UNSPECIFIED = 0; - - // In progress. - IN_PROGRESS = 1; - - // Paused. - PAUSED = 2; - - // Completed successfully. - SUCCESS = 3; - - // Terminated due to an unrecoverable failure. - FAILED = 4; - - // Aborted by the user. - ABORTED = 5; - - // Temporarily delayed by the system. No user action is required. - QUEUED = 6; - } - - // A globally unique ID assigned by the system. - string name = 1; - - // The ID of the Google Cloud project that owns the operation. - string project_id = 2; - - // Transfer specification. - TransferSpec transfer_spec = 3; - - // Notification configuration. - NotificationConfig notification_config = 10; - - // Start time of this transfer execution. - google.protobuf.Timestamp start_time = 4; - - // End time of this transfer execution. - google.protobuf.Timestamp end_time = 5; - - // Status of the transfer operation. - Status status = 6; - - // Information about the progress of the transfer operation. - TransferCounters counters = 7; - - // Summarizes errors encountered with sample error log entries. - repeated ErrorSummary error_breakdowns = 8; - - // The name of the transfer job that triggers this transfer operation. - string transfer_job_name = 9; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json deleted file mode 100644 index 5dd0a10..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json +++ /dev/null @@ -1,631 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-storagetransfer", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.storagetransfer.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async", - "title": "StorageTransferService getGoogleServiceAccount Sample", - "origin": "API_DEFINITION", - "description": " Returns the Google service account that is used by Storage Transfer Service to access buckets in the project where transfers run or in other projects. Each Google service account is associated with one Google Cloud project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only be used by Storage Transfer Service.", - "canonical": true, - "file": "storage_transfer_service.get_google_service_account.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGoogleServiceAccount", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetGoogleServiceAccount", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.GoogleServiceAccount", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "GetGoogleServiceAccount", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetGoogleServiceAccount", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async", - "title": "StorageTransferService createTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Creates a transfer job that runs periodically.", - "canonical": true, - "file": "storage_transfer_service.create_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.CreateTransferJob", - "async": true, - "parameters": [ - { - "name": "transfer_job", - "type": ".google.storagetransfer.v1.TransferJob" - } - ], - "resultType": ".google.storagetransfer.v1.TransferJob", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "CreateTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.CreateTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async", - "title": "StorageTransferService updateTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running already. **Note:** The job's [status][google.storagetransfer.v1.TransferJob.status] field can be modified using this RPC (for example, to set a job's status to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED], [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], or [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]).", - "canonical": true, - "file": "storage_transfer_service.update_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateTransferJob", - "async": true, - "parameters": [ - { - "name": "job_name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "transfer_job", - "type": ".google.storagetransfer.v1.TransferJob" - }, - { - "name": "update_transfer_job_field_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.storagetransfer.v1.TransferJob", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "UpdateTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async", - "title": "StorageTransferService getTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Gets a transfer job.", - "canonical": true, - "file": "storage_transfer_service.get_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetTransferJob", - "async": true, - "parameters": [ - { - "name": "job_name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.TransferJob", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "GetTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async", - "title": "StorageTransferService listTransferJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists transfer jobs.", - "canonical": true, - "file": "storage_transfer_service.list_transfer_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTransferJobs", - "fullName": "google.storagetransfer.v1.StorageTransferService.ListTransferJobs", - "async": true, - "parameters": [ - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.ListTransferJobsResponse", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "ListTransferJobs", - "fullName": "google.storagetransfer.v1.StorageTransferService.ListTransferJobs", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async", - "title": "StorageTransferService pauseTransferOperation Sample", - "origin": "API_DEFINITION", - "description": " Pauses a transfer operation.", - "canonical": true, - "file": "storage_transfer_service.pause_transfer_operation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PauseTransferOperation", - "fullName": "google.storagetransfer.v1.StorageTransferService.PauseTransferOperation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "PauseTransferOperation", - "fullName": "google.storagetransfer.v1.StorageTransferService.PauseTransferOperation", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async", - "title": "StorageTransferService resumeTransferOperation Sample", - "origin": "API_DEFINITION", - "description": " Resumes a transfer operation that is paused.", - "canonical": true, - "file": "storage_transfer_service.resume_transfer_operation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResumeTransferOperation", - "fullName": "google.storagetransfer.v1.StorageTransferService.ResumeTransferOperation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "ResumeTransferOperation", - "fullName": "google.storagetransfer.v1.StorageTransferService.ResumeTransferOperation", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async", - "title": "StorageTransferService runTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Attempts to start a new TransferOperation for the current TransferJob. A TransferJob has a maximum of one active TransferOperation. If this method is called while a TransferOperation is active, an error will be returned.", - "canonical": true, - "file": "storage_transfer_service.run_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.RunTransferJob", - "async": true, - "parameters": [ - { - "name": "job_name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "RunTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.RunTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async", - "title": "StorageTransferService deleteTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Deletes a transfer job. Deleting a transfer job sets its status to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED].", - "canonical": true, - "file": "storage_transfer_service.delete_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", - "async": true, - "parameters": [ - { - "name": "job_name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "DeleteTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async", - "title": "StorageTransferService createAgentPool Sample", - "origin": "API_DEFINITION", - "description": " Creates an agent pool resource.", - "canonical": true, - "file": "storage_transfer_service.create_agent_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.CreateAgentPool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "agent_pool", - "type": ".google.storagetransfer.v1.AgentPool" - }, - { - "name": "agent_pool_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.AgentPool", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "CreateAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.CreateAgentPool", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async", - "title": "StorageTransferService updateAgentPool Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing agent pool resource.", - "canonical": true, - "file": "storage_transfer_service.update_agent_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateAgentPool", - "async": true, - "parameters": [ - { - "name": "agent_pool", - "type": ".google.storagetransfer.v1.AgentPool" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.storagetransfer.v1.AgentPool", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "UpdateAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateAgentPool", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async", - "title": "StorageTransferService getAgentPool Sample", - "origin": "API_DEFINITION", - "description": " Gets an agent pool.", - "canonical": true, - "file": "storage_transfer_service.get_agent_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetAgentPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.AgentPool", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "GetAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetAgentPool", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async", - "title": "StorageTransferService listAgentPools Sample", - "origin": "API_DEFINITION", - "description": " Lists agent pools.", - "canonical": true, - "file": "storage_transfer_service.list_agent_pools.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAgentPools", - "fullName": "google.storagetransfer.v1.StorageTransferService.ListAgentPools", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.ListAgentPoolsResponse", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "ListAgentPools", - "fullName": "google.storagetransfer.v1.StorageTransferService.ListAgentPools", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async", - "title": "StorageTransferService deleteAgentPool Sample", - "origin": "API_DEFINITION", - "description": " Deletes an agent pool.", - "canonical": true, - "file": "storage_transfer_service.delete_agent_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteAgentPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "DeleteAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteAgentPool", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js deleted file mode 100644 index ed5464a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.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(projectId, agentPool, agentPoolId) { - // [START storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Google Cloud project that owns the - * agent pool. - */ - // const projectId = 'abc123' - /** - * Required. The agent pool to create. - */ - // const agentPool = {} - /** - * Required. The ID of the agent pool to create. - * The `agent_pool_id` must meet the following requirements: - * * Length of 128 characters or less. - * * Not start with the string `goog`. - * * Start with a lowercase ASCII character, followed by: - * * Zero or more: lowercase Latin alphabet characters, numerals, - * hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). - * * One or more numerals or lowercase ASCII characters. - * As expressed by the regular expression: - * `^(?!goog)a-z(a-z0-9-._~*a-z0-9)?$`. - */ - // const agentPoolId = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callCreateAgentPool() { - // Construct request - const request = { - projectId, - agentPool, - agentPoolId, - }; - - // Run request - const response = await storagetransferClient.createAgentPool(request); - console.log(response); - } - - callCreateAgentPool(); - // [END storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_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/storage_transfer_service.create_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js deleted file mode 100644 index 5daf776..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js +++ /dev/null @@ -1,61 +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(transferJob) { - // [START storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The job to create. - */ - // const transferJob = {} - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callCreateTransferJob() { - // Construct request - const request = { - transferJob, - }; - - // Run request - const response = await storagetransferClient.createTransferJob(request); - console.log(response); - } - - callCreateTransferJob(); - // [END storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_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/storage_transfer_service.delete_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js deleted file mode 100644 index fe2d324..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js +++ /dev/null @@ -1,61 +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 storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent pool to delete. - */ - // const name = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callDeleteAgentPool() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await storagetransferClient.deleteAgentPool(request); - console.log(response); - } - - callDeleteAgentPool(); - // [END storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_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/storage_transfer_service.get_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js deleted file mode 100644 index 4b30734..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js +++ /dev/null @@ -1,61 +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 storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent pool to get. - */ - // const name = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callGetAgentPool() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await storagetransferClient.getAgentPool(request); - console.log(response); - } - - callGetAgentPool(); - // [END storagetransfer_v1_generated_StorageTransferService_GetAgentPool_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/storage_transfer_service.get_google_service_account.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js deleted file mode 100644 index 1b8411e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js +++ /dev/null @@ -1,62 +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(projectId) { - // [START storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Google Cloud project that the Google service - * account is associated with. - */ - // const projectId = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callGetGoogleServiceAccount() { - // Construct request - const request = { - projectId, - }; - - // Run request - const response = await storagetransferClient.getGoogleServiceAccount(request); - console.log(response); - } - - callGetGoogleServiceAccount(); - // [END storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_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/storage_transfer_service.get_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.js deleted file mode 100644 index c7cbd13..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.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(jobName, projectId) { - // [START storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The job to get. - */ - // const jobName = 'abc123' - /** - * Required. The ID of the Google Cloud project that owns the - * job. - */ - // const projectId = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callGetTransferJob() { - // Construct request - const request = { - jobName, - projectId, - }; - - // Run request - const response = await storagetransferClient.getTransferJob(request); - console.log(response); - } - - callGetTransferJob(); - // [END storagetransfer_v1_generated_StorageTransferService_GetTransferJob_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/storage_transfer_service.list_agent_pools.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js deleted file mode 100644 index 636a133..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId) { - // [START storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Google Cloud project that owns the job. - */ - // const projectId = 'abc123' - /** - * An optional list of query parameters specified as JSON text in the - * form of: - * `{"agentPoolNames":"agentpool1","agentpool2",... }` - * Since `agentPoolNames` support multiple values, its values must be - * specified with array notation. When the filter is either empty or not - * provided, the list returns all agent pools for the project. - */ - // const filter = 'abc123' - /** - * The list page size. The max allowed value is `256`. - */ - // const pageSize = 1234 - /** - * The list page token. - */ - // const pageToken = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callListAgentPools() { - // Construct request - const request = { - projectId, - }; - - // Run request - const iterable = await storagetransferClient.listAgentPoolsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAgentPools(); - // [END storagetransfer_v1_generated_StorageTransferService_ListAgentPools_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/storage_transfer_service.list_transfer_jobs.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js deleted file mode 100644 index fa1d170..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.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(filter) { - // [START storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":"jobid1","jobid2",..., - * "jobStatuses":"status1","status2",... }` - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * ENABLED google.storagetransfer.v1.TransferJob.Status.ENABLED, - * DISABLED google.storagetransfer.v1.TransferJob.Status.DISABLED, and - * DELETED google.storagetransfer.v1.TransferJob.Status.DELETED. - */ - // const filter = 'abc123' - /** - * The list page size. The max allowed value is 256. - */ - // const pageSize = 1234 - /** - * The list page token. - */ - // const pageToken = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callListTransferJobs() { - // Construct request - const request = { - filter, - }; - - // Run request - const iterable = await storagetransferClient.listTransferJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTransferJobs(); - // [END storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_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/storage_transfer_service.pause_transfer_operation.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js deleted file mode 100644 index 9a11fd3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js +++ /dev/null @@ -1,61 +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 storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the transfer operation. - */ - // const name = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callPauseTransferOperation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await storagetransferClient.pauseTransferOperation(request); - console.log(response); - } - - callPauseTransferOperation(); - // [END storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_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/storage_transfer_service.resume_transfer_operation.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js deleted file mode 100644 index 565ac82..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js +++ /dev/null @@ -1,61 +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 storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the transfer operation. - */ - // const name = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callResumeTransferOperation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await storagetransferClient.resumeTransferOperation(request); - console.log(response); - } - - callResumeTransferOperation(); - // [END storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_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/storage_transfer_service.run_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js deleted file mode 100644 index ce83387..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js +++ /dev/null @@ -1,68 +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(jobName, projectId) { - // [START storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the transfer job. - */ - // const jobName = 'abc123' - /** - * Required. The ID of the Google Cloud project that owns the transfer - * job. - */ - // const projectId = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callRunTransferJob() { - // Construct request - const request = { - jobName, - projectId, - }; - - // Run request - const [operation] = await storagetransferClient.runTransferJob(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunTransferJob(); - // [END storagetransfer_v1_generated_StorageTransferService_RunTransferJob_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/storage_transfer_service.update_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.js deleted file mode 100644 index b2cf855..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.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(agentPool) { - // [START storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent pool to update. `agent_pool` is expected to specify following - * fields: - * * name google.storagetransfer.v1.AgentPool.name - * * display_name google.storagetransfer.v1.AgentPool.display_name - * * bandwidth_limit google.storagetransfer.v1.AgentPool.bandwidth_limit - * An `UpdateAgentPoolRequest` with any other fields is rejected - * with the error INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. - */ - // const agentPool = {} - /** - * The field mask - * (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) - * of the fields in `agentPool` to update in this request. - * The following `agentPool` fields can be updated: - * * display_name google.storagetransfer.v1.AgentPool.display_name - * * bandwidth_limit google.storagetransfer.v1.AgentPool.bandwidth_limit - */ - // const updateMask = {} - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callUpdateAgentPool() { - // Construct request - const request = { - agentPool, - }; - - // Run request - const response = await storagetransferClient.updateAgentPool(request); - console.log(response); - } - - callUpdateAgentPool(); - // [END storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_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/storage_transfer_service.update_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js deleted file mode 100644 index 7961e98..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js +++ /dev/null @@ -1,94 +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(jobName, projectId, transferJob) { - // [START storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of job to update. - */ - // const jobName = 'abc123' - /** - * Required. The ID of the Google Cloud project that owns the - * job. - */ - // const projectId = 'abc123' - /** - * Required. The job to update. `transferJob` is expected to specify one or more of - * five fields: description google.storagetransfer.v1.TransferJob.description, - * transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec, - * notification_config google.storagetransfer.v1.TransferJob.notification_config, - * logging_config google.storagetransfer.v1.TransferJob.logging_config, and - * status google.storagetransfer.v1.TransferJob.status. An `UpdateTransferJobRequest` that specifies - * other fields are rejected with the error - * INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. Updating a job status - * to DELETED google.storagetransfer.v1.TransferJob.Status.DELETED requires - * `storagetransfer.jobs.delete` permission. - */ - // const transferJob = {} - /** - * The field mask of the fields in `transferJob` that are to be updated in - * this request. Fields in `transferJob` that can be updated are: - * description google.storagetransfer.v1.TransferJob.description, - * transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec, - * notification_config google.storagetransfer.v1.TransferJob.notification_config, - * logging_config google.storagetransfer.v1.TransferJob.logging_config, and - * status google.storagetransfer.v1.TransferJob.status. To update the `transfer_spec` of the job, a - * complete transfer specification must be provided. An incomplete - * specification missing any required fields is rejected with the error - * INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. - */ - // const updateTransferJobFieldMask = {} - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callUpdateTransferJob() { - // Construct request - const request = { - jobName, - projectId, - transferJob, - }; - - // Run request - const response = await storagetransferClient.updateTransferJob(request); - console.log(response); - } - - callUpdateTransferJob(); - // [END storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index b2ff704..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 StorageTransferServiceClient = v1.StorageTransferServiceClient; -type StorageTransferServiceClient = v1.StorageTransferServiceClient; -export {v1, StorageTransferServiceClient}; -export default {v1, StorageTransferServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 4155aeb..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.storagetransfer.v1", - "libraryPackage": "@google-cloud/storage-transfer", - "services": { - "StorageTransferService": { - "clients": { - "grpc": { - "libraryClient": "StorageTransferServiceClient", - "rpcs": { - "GetGoogleServiceAccount": { - "methods": [ - "getGoogleServiceAccount" - ] - }, - "CreateTransferJob": { - "methods": [ - "createTransferJob" - ] - }, - "UpdateTransferJob": { - "methods": [ - "updateTransferJob" - ] - }, - "GetTransferJob": { - "methods": [ - "getTransferJob" - ] - }, - "PauseTransferOperation": { - "methods": [ - "pauseTransferOperation" - ] - }, - "ResumeTransferOperation": { - "methods": [ - "resumeTransferOperation" - ] - }, - "DeleteTransferJob": { - "methods": [ - "deleteTransferJob" - ] - }, - "CreateAgentPool": { - "methods": [ - "createAgentPool" - ] - }, - "UpdateAgentPool": { - "methods": [ - "updateAgentPool" - ] - }, - "GetAgentPool": { - "methods": [ - "getAgentPool" - ] - }, - "DeleteAgentPool": { - "methods": [ - "deleteAgentPool" - ] - }, - "RunTransferJob": { - "methods": [ - "runTransferJob" - ] - }, - "ListTransferJobs": { - "methods": [ - "listTransferJobs", - "listTransferJobsStream", - "listTransferJobsAsync" - ] - }, - "ListAgentPools": { - "methods": [ - "listAgentPools", - "listAgentPoolsStream", - "listAgentPoolsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "StorageTransferServiceClient", - "rpcs": { - "GetGoogleServiceAccount": { - "methods": [ - "getGoogleServiceAccount" - ] - }, - "CreateTransferJob": { - "methods": [ - "createTransferJob" - ] - }, - "UpdateTransferJob": { - "methods": [ - "updateTransferJob" - ] - }, - "GetTransferJob": { - "methods": [ - "getTransferJob" - ] - }, - "PauseTransferOperation": { - "methods": [ - "pauseTransferOperation" - ] - }, - "ResumeTransferOperation": { - "methods": [ - "resumeTransferOperation" - ] - }, - "DeleteTransferJob": { - "methods": [ - "deleteTransferJob" - ] - }, - "CreateAgentPool": { - "methods": [ - "createAgentPool" - ] - }, - "UpdateAgentPool": { - "methods": [ - "updateAgentPool" - ] - }, - "GetAgentPool": { - "methods": [ - "getAgentPool" - ] - }, - "DeleteAgentPool": { - "methods": [ - "deleteAgentPool" - ] - }, - "RunTransferJob": { - "methods": [ - "runTransferJob" - ] - }, - "ListTransferJobs": { - "methods": [ - "listTransferJobs", - "listTransferJobsStream", - "listTransferJobsAsync" - ] - }, - "ListAgentPools": { - "methods": [ - "listAgentPools", - "listAgentPoolsStream", - "listAgentPoolsAsync" - ] - } - } - } - } - } - } -} 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 f0a69d4..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 {StorageTransferServiceClient} from './storage_transfer_service_client'; diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts b/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts deleted file mode 100644 index 2a394a9..0000000 --- a/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts +++ /dev/null @@ -1,1916 +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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/storage_transfer_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './storage_transfer_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Storage Transfer Service and its protos. - * Transfers data between between Google Cloud Storage buckets or from a data - * source external to Google to a Cloud Storage bucket. - * @class - * @memberof v1 - */ -export class StorageTransferServiceClient { - 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; - storageTransferServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of StorageTransferServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new StorageTransferServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof StorageTransferServiceClient; - 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - agentPoolsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_id}/agentPools/{agent_pool_id}' - ), - }; - - // 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 = { - listTransferJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'transferJobs'), - listAgentPools: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'agentPools') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=transferOperations/**}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=transferOperations/**}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=transferOperations}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const runTransferJobResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const runTransferJobMetadata = protoFilesRoot.lookup( - '.google.storagetransfer.v1.TransferOperation') as gax.protobuf.Type; - - this.descriptors.longrunning = { - runTransferJob: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runTransferJobResponse.decode.bind(runTransferJobResponse), - runTransferJobMetadata.decode.bind(runTransferJobMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.storagetransfer.v1.StorageTransferService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.storageTransferServiceStub) { - return this.storageTransferServiceStub; - } - - // Put together the "service stub" for - // google.storagetransfer.v1.StorageTransferService. - this.storageTransferServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.storagetransfer.v1.StorageTransferService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.storagetransfer.v1.StorageTransferService, - 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 storageTransferServiceStubMethods = - ['getGoogleServiceAccount', 'createTransferJob', 'updateTransferJob', 'getTransferJob', 'listTransferJobs', 'pauseTransferOperation', 'resumeTransferOperation', 'runTransferJob', 'deleteTransferJob', 'createAgentPool', 'updateAgentPool', 'getAgentPool', 'listAgentPools', 'deleteAgentPool']; - for (const methodName of storageTransferServiceStubMethods) { - const callPromise = this.storageTransferServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.storageTransferServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'storagetransfer.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 'storagetransfer.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 -- - // ------------------- -/** - * Returns the Google service account that is used by Storage Transfer - * Service to access buckets in the project where transfers - * run or in other projects. Each Google service account is associated - * with one Google Cloud project. Users - * should add this service account to the Google Cloud Storage bucket - * ACLs to grant access to Storage Transfer Service. This service - * account is created and owned by Storage Transfer Service and can - * only be used by Storage Transfer Service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that the Google service - * account is associated with. - * @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 [GoogleServiceAccount]{@link google.storagetransfer.v1.GoogleServiceAccount}. - * 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/storage_transfer_service.get_google_service_account.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async - */ - getGoogleServiceAccount( - request?: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|undefined, {}|undefined - ]>; - getGoogleServiceAccount( - request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, - {}|null|undefined>): void; - getGoogleServiceAccount( - request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, - callback: Callback< - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, - {}|null|undefined>): void; - getGoogleServiceAccount( - request?: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId || '', - }); - this.initialize(); - return this.innerApiCalls.getGoogleServiceAccount(request, options, callback); - } -/** - * Creates a transfer job that runs periodically. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.storagetransfer.v1.TransferJob} request.transferJob - * Required. The job to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TransferJob]{@link google.storagetransfer.v1.TransferJob}. - * 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/storage_transfer_service.create_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async - */ - createTransferJob( - request?: protos.google.storagetransfer.v1.ICreateTransferJobRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|undefined, {}|undefined - ]>; - createTransferJob( - request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, - {}|null|undefined>): void; - createTransferJob( - request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, - {}|null|undefined>): void; - createTransferJob( - request?: protos.google.storagetransfer.v1.ICreateTransferJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.createTransferJob(request, options, callback); - } -/** - * Updates a transfer job. Updating a job's transfer spec does not affect - * transfer operations that are running already. - * - * **Note:** The job's {@link google.storagetransfer.v1.TransferJob.status|status} field can be modified - * using this RPC (for example, to set a job's status to - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}, - * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, or - * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.jobName - * Required. The name of job to update. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the - * job. - * @param {google.storagetransfer.v1.TransferJob} request.transferJob - * Required. The job to update. `transferJob` is expected to specify one or more of - * five fields: {@link google.storagetransfer.v1.TransferJob.description|description}, - * {@link google.storagetransfer.v1.TransferJob.transfer_spec|transfer_spec}, - * {@link google.storagetransfer.v1.TransferJob.notification_config|notification_config}, - * {@link google.storagetransfer.v1.TransferJob.logging_config|logging_config}, and - * {@link google.storagetransfer.v1.TransferJob.status|status}. An `UpdateTransferJobRequest` that specifies - * other fields are rejected with the error - * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. Updating a job status - * to {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED} requires - * `storagetransfer.jobs.delete` permission. - * @param {google.protobuf.FieldMask} request.updateTransferJobFieldMask - * The field mask of the fields in `transferJob` that are to be updated in - * this request. Fields in `transferJob` that can be updated are: - * {@link google.storagetransfer.v1.TransferJob.description|description}, - * {@link google.storagetransfer.v1.TransferJob.transfer_spec|transfer_spec}, - * {@link google.storagetransfer.v1.TransferJob.notification_config|notification_config}, - * {@link google.storagetransfer.v1.TransferJob.logging_config|logging_config}, and - * {@link google.storagetransfer.v1.TransferJob.status|status}. To update the `transfer_spec` of the job, a - * complete transfer specification must be provided. An incomplete - * specification missing any required fields is rejected with the error - * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. - * @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 [TransferJob]{@link google.storagetransfer.v1.TransferJob}. - * 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/storage_transfer_service.update_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async - */ - updateTransferJob( - request?: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|undefined, {}|undefined - ]>; - updateTransferJob( - request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, - {}|null|undefined>): void; - updateTransferJob( - request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, - {}|null|undefined>): void; - updateTransferJob( - request?: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'job_name': request.jobName || '', - }); - this.initialize(); - return this.innerApiCalls.updateTransferJob(request, options, callback); - } -/** - * Gets a transfer job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.jobName - * Required. The job to get. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the - * job. - * @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 [TransferJob]{@link google.storagetransfer.v1.TransferJob}. - * 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/storage_transfer_service.get_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async - */ - getTransferJob( - request?: protos.google.storagetransfer.v1.IGetTransferJobRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|undefined, {}|undefined - ]>; - getTransferJob( - request: protos.google.storagetransfer.v1.IGetTransferJobRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, - {}|null|undefined>): void; - getTransferJob( - request: protos.google.storagetransfer.v1.IGetTransferJobRequest, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, - {}|null|undefined>): void; - getTransferJob( - request?: protos.google.storagetransfer.v1.IGetTransferJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'job_name': request.jobName || '', - }); - this.initialize(); - return this.innerApiCalls.getTransferJob(request, options, callback); - } -/** - * Pauses a transfer operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the transfer operation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/storage_transfer_service.pause_transfer_operation.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async - */ - pauseTransferOperation( - request?: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|undefined, {}|undefined - ]>; - pauseTransferOperation( - request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, - {}|null|undefined>): void; - pauseTransferOperation( - request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, - {}|null|undefined>): void; - pauseTransferOperation( - request?: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.pauseTransferOperation(request, options, callback); - } -/** - * Resumes a transfer operation that is paused. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the transfer operation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/storage_transfer_service.resume_transfer_operation.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async - */ - resumeTransferOperation( - request?: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|undefined, {}|undefined - ]>; - resumeTransferOperation( - request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, - {}|null|undefined>): void; - resumeTransferOperation( - request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, - {}|null|undefined>): void; - resumeTransferOperation( - request?: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.resumeTransferOperation(request, options, callback); - } -/** - * Deletes a transfer job. Deleting a transfer job sets its status to - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.jobName - * Required. The job to delete. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the - * job. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/storage_transfer_service.delete_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async - */ - deleteTransferJob( - request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|undefined, {}|undefined - ]>; - deleteTransferJob( - request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, - {}|null|undefined>): void; - deleteTransferJob( - request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, - {}|null|undefined>): void; - deleteTransferJob( - request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'job_name': request.jobName || '', - }); - this.initialize(); - return this.innerApiCalls.deleteTransferJob(request, options, callback); - } -/** - * Creates an agent pool resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the - * agent pool. - * @param {google.storagetransfer.v1.AgentPool} request.agentPool - * Required. The agent pool to create. - * @param {string} request.agentPoolId - * Required. The ID of the agent pool to create. - * - * The `agent_pool_id` must meet the following requirements: - * - * * Length of 128 characters or less. - * * Not start with the string `goog`. - * * Start with a lowercase ASCII character, followed by: - * * Zero or more: lowercase Latin alphabet characters, numerals, - * hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). - * * One or more numerals or lowercase ASCII characters. - * - * As expressed by the regular expression: - * `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`. - * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. - * 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/storage_transfer_service.create_agent_pool.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async - */ - createAgentPool( - request?: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|undefined, {}|undefined - ]>; - createAgentPool( - request: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - createAgentPool( - request: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - createAgentPool( - request?: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId || '', - }); - this.initialize(); - return this.innerApiCalls.createAgentPool(request, options, callback); - } -/** - * Updates an existing agent pool resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.storagetransfer.v1.AgentPool} request.agentPool - * Required. The agent pool to update. `agent_pool` is expected to specify following - * fields: - * - * * {@link google.storagetransfer.v1.AgentPool.name|name} - * - * * {@link google.storagetransfer.v1.AgentPool.display_name|display_name} - * - * * {@link google.storagetransfer.v1.AgentPool.bandwidth_limit|bandwidth_limit} - * An `UpdateAgentPoolRequest` with any other fields is rejected - * with the error {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. - * @param {google.protobuf.FieldMask} request.updateMask - * The [field mask] - * (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) - * of the fields in `agentPool` to update in this request. - * The following `agentPool` fields can be updated: - * - * * {@link google.storagetransfer.v1.AgentPool.display_name|display_name} - * - * * {@link google.storagetransfer.v1.AgentPool.bandwidth_limit|bandwidth_limit} - * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. - * 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/storage_transfer_service.update_agent_pool.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async - */ - updateAgentPool( - request?: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|undefined, {}|undefined - ]>; - updateAgentPool( - request: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - updateAgentPool( - request: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - updateAgentPool( - request?: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'agent_pool.name': request.agentPool!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateAgentPool(request, options, callback); - } -/** - * Gets an agent pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the agent pool to get. - * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. - * 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/storage_transfer_service.get_agent_pool.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async - */ - getAgentPool( - request?: protos.google.storagetransfer.v1.IGetAgentPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|undefined, {}|undefined - ]>; - getAgentPool( - request: protos.google.storagetransfer.v1.IGetAgentPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - getAgentPool( - request: protos.google.storagetransfer.v1.IGetAgentPoolRequest, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - getAgentPool( - request?: protos.google.storagetransfer.v1.IGetAgentPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getAgentPool(request, options, callback); - } -/** - * Deletes an agent pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the agent pool to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/storage_transfer_service.delete_agent_pool.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async - */ - deleteAgentPool( - request?: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|undefined, {}|undefined - ]>; - deleteAgentPool( - request: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - deleteAgentPool( - request: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - deleteAgentPool( - request?: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteAgentPool(request, options, callback); - } - -/** - * Attempts to start a new TransferOperation for the current TransferJob. A - * TransferJob has a maximum of one active TransferOperation. If this method - * is called while a TransferOperation is active, an error will be returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.jobName - * Required. The name of the transfer job. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the transfer - * job. - * @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/storage_transfer_service.run_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async - */ - runTransferJob( - request?: protos.google.storagetransfer.v1.IRunTransferJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runTransferJob( - request: protos.google.storagetransfer.v1.IRunTransferJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runTransferJob( - request: protos.google.storagetransfer.v1.IRunTransferJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runTransferJob( - request?: protos.google.storagetransfer.v1.IRunTransferJobRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'job_name': request.jobName || '', - }); - this.initialize(); - return this.innerApiCalls.runTransferJob(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runTransferJob()`. - * @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/storage_transfer_service.run_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async - */ - async checkRunTransferJobProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runTransferJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists transfer jobs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":["jobid1","jobid2",...], - * "jobStatuses":["status1","status2",...]}` - * - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, - * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. - * @param {number} request.pageSize - * The list page size. The max allowed value is 256. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [TransferJob]{@link google.storagetransfer.v1.TransferJob}. - * 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 `listTransferJobsAsync()` - * 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. - */ - listTransferJobs( - request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob[], - protos.google.storagetransfer.v1.IListTransferJobsRequest|null, - protos.google.storagetransfer.v1.IListTransferJobsResponse - ]>; - listTransferJobs( - request: protos.google.storagetransfer.v1.IListTransferJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.storagetransfer.v1.IListTransferJobsRequest, - protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, - protos.google.storagetransfer.v1.ITransferJob>): void; - listTransferJobs( - request: protos.google.storagetransfer.v1.IListTransferJobsRequest, - callback: PaginationCallback< - protos.google.storagetransfer.v1.IListTransferJobsRequest, - protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, - protos.google.storagetransfer.v1.ITransferJob>): void; - listTransferJobs( - request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.storagetransfer.v1.IListTransferJobsRequest, - protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, - protos.google.storagetransfer.v1.ITransferJob>, - callback?: PaginationCallback< - protos.google.storagetransfer.v1.IListTransferJobsRequest, - protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, - protos.google.storagetransfer.v1.ITransferJob>): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob[], - protos.google.storagetransfer.v1.IListTransferJobsRequest|null, - protos.google.storagetransfer.v1.IListTransferJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.listTransferJobs(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.filter - * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":["jobid1","jobid2",...], - * "jobStatuses":["status1","status2",...]}` - * - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, - * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. - * @param {number} request.pageSize - * The list page size. The max allowed value is 256. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [TransferJob]{@link google.storagetransfer.v1.TransferJob} 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 `listTransferJobsAsync()` - * 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. - */ - listTransferJobsStream( - request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listTransferJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTransferJobs.createStream( - this.innerApiCalls.listTransferJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTransferJobs`, 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.filter - * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":["jobid1","jobid2",...], - * "jobStatuses":["status1","status2",...]}` - * - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, - * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. - * @param {number} request.pageSize - * The list page size. The max allowed value is 256. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [TransferJob]{@link google.storagetransfer.v1.TransferJob}. 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/storage_transfer_service.list_transfer_jobs.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async - */ - listTransferJobsAsync( - request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listTransferJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTransferJobs.asyncIterate( - this.innerApiCalls['listTransferJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists agent pools. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the job. - * @param {string} request.filter - * An optional list of query parameters specified as JSON text in the - * form of: - * - * `{"agentPoolNames":["agentpool1","agentpool2",...]}` - * - * Since `agentPoolNames` support multiple values, its values must be - * specified with array notation. When the filter is either empty or not - * provided, the list returns all agent pools for the project. - * @param {number} request.pageSize - * The list page size. The max allowed value is `256`. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [AgentPool]{@link google.storagetransfer.v1.AgentPool}. - * 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 `listAgentPoolsAsync()` - * 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. - */ - listAgentPools( - request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool[], - protos.google.storagetransfer.v1.IListAgentPoolsRequest|null, - protos.google.storagetransfer.v1.IListAgentPoolsResponse - ]>; - listAgentPools( - request: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.storagetransfer.v1.IListAgentPoolsRequest, - protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, - protos.google.storagetransfer.v1.IAgentPool>): void; - listAgentPools( - request: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - callback: PaginationCallback< - protos.google.storagetransfer.v1.IListAgentPoolsRequest, - protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, - protos.google.storagetransfer.v1.IAgentPool>): void; - listAgentPools( - request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.storagetransfer.v1.IListAgentPoolsRequest, - protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, - protos.google.storagetransfer.v1.IAgentPool>, - callback?: PaginationCallback< - protos.google.storagetransfer.v1.IListAgentPoolsRequest, - protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, - protos.google.storagetransfer.v1.IAgentPool>): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool[], - protos.google.storagetransfer.v1.IListAgentPoolsRequest|null, - protos.google.storagetransfer.v1.IListAgentPoolsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId || '', - }); - this.initialize(); - return this.innerApiCalls.listAgentPools(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.projectId - * Required. The ID of the Google Cloud project that owns the job. - * @param {string} request.filter - * An optional list of query parameters specified as JSON text in the - * form of: - * - * `{"agentPoolNames":["agentpool1","agentpool2",...]}` - * - * Since `agentPoolNames` support multiple values, its values must be - * specified with array notation. When the filter is either empty or not - * provided, the list returns all agent pools for the project. - * @param {number} request.pageSize - * The list page size. The max allowed value is `256`. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [AgentPool]{@link google.storagetransfer.v1.AgentPool} 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 `listAgentPoolsAsync()` - * 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. - */ - listAgentPoolsStream( - request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId || '', - }); - const defaultCallSettings = this._defaults['listAgentPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAgentPools.createStream( - this.innerApiCalls.listAgentPools as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAgentPools`, 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.projectId - * Required. The ID of the Google Cloud project that owns the job. - * @param {string} request.filter - * An optional list of query parameters specified as JSON text in the - * form of: - * - * `{"agentPoolNames":["agentpool1","agentpool2",...]}` - * - * Since `agentPoolNames` support multiple values, its values must be - * specified with array notation. When the filter is either empty or not - * provided, the list returns all agent pools for the project. - * @param {number} request.pageSize - * The list page size. The max allowed value is `256`. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [AgentPool]{@link google.storagetransfer.v1.AgentPool}. 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/storage_transfer_service.list_agent_pools.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async - */ - listAgentPoolsAsync( - request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId || '', - }); - const defaultCallSettings = this._defaults['listAgentPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAgentPools.asyncIterate( - this.innerApiCalls['listAgentPools'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified agentPools resource name string. - * - * @param {string} project_id - * @param {string} agent_pool_id - * @returns {string} Resource name string. - */ - agentPoolsPath(projectId:string,agentPoolId:string) { - return this.pathTemplates.agentPoolsPathTemplate.render({ - project_id: projectId, - agent_pool_id: agentPoolId, - }); - } - - /** - * Parse the project_id from AgentPools resource. - * - * @param {string} agentPoolsName - * A fully-qualified path representing agentPools resource. - * @returns {string} A string representing the project_id. - */ - matchProjectIdFromAgentPoolsName(agentPoolsName: string) { - return this.pathTemplates.agentPoolsPathTemplate.match(agentPoolsName).project_id; - } - - /** - * Parse the agent_pool_id from AgentPools resource. - * - * @param {string} agentPoolsName - * A fully-qualified path representing agentPools resource. - * @returns {string} A string representing the agent_pool_id. - */ - matchAgentPoolIdFromAgentPoolsName(agentPoolsName: string) { - return this.pathTemplates.agentPoolsPathTemplate.match(agentPoolsName).agent_pool_id; - } - - /** - * 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.storageTransferServiceStub && !this._terminated) { - return this.storageTransferServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json b/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json deleted file mode 100644 index 93b4537..0000000 --- a/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "interfaces": { - "google.storagetransfer.v1.StorageTransferService": { - "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 - }, - "264268458a9e88347dbacbd9398202ff5885a40b": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 2, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetGoogleServiceAccount": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "CreateTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "GetTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ListTransferJobs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "PauseTransferOperation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ResumeTransferOperation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "RunTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "DeleteTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "CreateAgentPool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "UpdateAgentPool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "GetAgentPool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ListAgentPools": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "DeleteAgentPool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json b/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json deleted file mode 100644 index ea755b4..0000000 --- a/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/storagetransfer/v1/transfer.proto", - "../../protos/google/storagetransfer/v1/transfer_types.proto" -] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 842da4d..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 storagetransfer = require('@google-cloud/storage-transfer'); - -function main() { - const storageTransferServiceClient = new storagetransfer.StorageTransferServiceClient(); -} - -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 458ee50..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 {StorageTransferServiceClient} from '@google-cloud/storage-transfer'; - -// check that the client class type name can be used -function doStuffWithStorageTransferServiceClient(client: StorageTransferServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const storageTransferServiceClient = new StorageTransferServiceClient(); - doStuffWithStorageTransferServiceClient(storageTransferServiceClient); -} - -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 557a575..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_storage_transfer_service_v1.ts b/owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts deleted file mode 100644 index 0298604..0000000 --- a/owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts +++ /dev/null @@ -1,2080 +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 storagetransferserviceModule 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.StorageTransferServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = storagetransferserviceModule.v1.StorageTransferServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = storagetransferserviceModule.v1.StorageTransferServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = storagetransferserviceModule.v1.StorageTransferServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.storageTransferServiceStub, undefined); - await client.initialize(); - assert(client.storageTransferServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.storageTransferServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.storageTransferServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - 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 storagetransferserviceModule.v1.StorageTransferServiceClient({ - 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('getGoogleServiceAccount', () => { - it('invokes getGoogleServiceAccount without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.GoogleServiceAccount()); - client.innerApiCalls.getGoogleServiceAccount = stubSimpleCall(expectedResponse); - const [response] = await client.getGoogleServiceAccount(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getGoogleServiceAccount without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.GoogleServiceAccount()); - client.innerApiCalls.getGoogleServiceAccount = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGoogleServiceAccount( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IGoogleServiceAccount|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getGoogleServiceAccount with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getGoogleServiceAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGoogleServiceAccount(request), expectedError); - assert((client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getGoogleServiceAccount with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest()); - request.projectId = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getGoogleServiceAccount(request), expectedError); - }); - }); - - describe('createTransferJob', () => { - it('invokes createTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateTransferJobRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); - client.innerApiCalls.createTransferJob = stubSimpleCall(expectedResponse); - const [response] = await client.createTransferJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateTransferJobRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); - client.innerApiCalls.createTransferJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTransferJob( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createTransferJob with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateTransferJobRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; - const expectedError = new Error('expected'); - client.innerApiCalls.createTransferJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTransferJob(request), expectedError); - assert((client.innerApiCalls.createTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createTransferJob with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateTransferJobRequest()); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createTransferJob(request), expectedError); - }); - }); - - describe('updateTransferJob', () => { - it('invokes updateTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); - client.innerApiCalls.updateTransferJob = stubSimpleCall(expectedResponse); - const [response] = await client.updateTransferJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); - client.innerApiCalls.updateTransferJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTransferJob( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateTransferJob with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTransferJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateTransferJob(request), expectedError); - assert((client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateTransferJob with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateTransferJobRequest()); - request.jobName = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateTransferJob(request), expectedError); - }); - }); - - describe('getTransferJob', () => { - it('invokes getTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); - client.innerApiCalls.getTransferJob = stubSimpleCall(expectedResponse); - const [response] = await client.getTransferJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()); - client.innerApiCalls.getTransferJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTransferJob( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getTransferJob with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getTransferJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTransferJob(request), expectedError); - assert((client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getTransferJob with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetTransferJobRequest()); - request.jobName = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getTransferJob(request), expectedError); - }); - }); - - describe('pauseTransferOperation', () => { - it('invokes pauseTransferOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.PauseTransferOperationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.pauseTransferOperation = stubSimpleCall(expectedResponse); - const [response] = await client.pauseTransferOperation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes pauseTransferOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.PauseTransferOperationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.pauseTransferOperation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pauseTransferOperation( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes pauseTransferOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.PauseTransferOperationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseTransferOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pauseTransferOperation(request), expectedError); - assert((client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes pauseTransferOperation with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.PauseTransferOperationRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.pauseTransferOperation(request), expectedError); - }); - }); - - describe('resumeTransferOperation', () => { - it('invokes resumeTransferOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ResumeTransferOperationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.resumeTransferOperation = stubSimpleCall(expectedResponse); - const [response] = await client.resumeTransferOperation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes resumeTransferOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ResumeTransferOperationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.resumeTransferOperation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resumeTransferOperation( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes resumeTransferOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ResumeTransferOperationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeTransferOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resumeTransferOperation(request), expectedError); - assert((client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes resumeTransferOperation with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ResumeTransferOperationRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.resumeTransferOperation(request), expectedError); - }); - }); - - describe('deleteTransferJob', () => { - it('invokes deleteTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteTransferJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTransferJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteTransferJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTransferJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteTransferJob with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTransferJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTransferJob(request), expectedError); - assert((client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteTransferJob with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteTransferJobRequest()); - request.jobName = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteTransferJob(request), expectedError); - }); - }); - - describe('createAgentPool', () => { - it('invokes createAgentPool without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateAgentPoolRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); - client.innerApiCalls.createAgentPool = stubSimpleCall(expectedResponse); - const [response] = await client.createAgentPool(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createAgentPool without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateAgentPoolRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); - client.innerApiCalls.createAgentPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAgentPool( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createAgentPool with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateAgentPoolRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createAgentPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAgentPool(request), expectedError); - assert((client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createAgentPool with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.CreateAgentPoolRequest()); - request.projectId = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createAgentPool(request), expectedError); - }); - }); - - describe('updateAgentPool', () => { - it('invokes updateAgentPool without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateAgentPoolRequest()); - request.agentPool = {}; - request.agentPool.name = ''; - const expectedHeaderRequestParams = "agent_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); - client.innerApiCalls.updateAgentPool = stubSimpleCall(expectedResponse); - const [response] = await client.updateAgentPool(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateAgentPool without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateAgentPoolRequest()); - request.agentPool = {}; - request.agentPool.name = ''; - const expectedHeaderRequestParams = "agent_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); - client.innerApiCalls.updateAgentPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAgentPool( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateAgentPool with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateAgentPoolRequest()); - request.agentPool = {}; - request.agentPool.name = ''; - const expectedHeaderRequestParams = "agent_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAgentPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAgentPool(request), expectedError); - assert((client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateAgentPool with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.UpdateAgentPoolRequest()); - request.agentPool = {}; - request.agentPool.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateAgentPool(request), expectedError); - }); - }); - - describe('getAgentPool', () => { - it('invokes getAgentPool without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetAgentPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); - client.innerApiCalls.getAgentPool = stubSimpleCall(expectedResponse); - const [response] = await client.getAgentPool(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getAgentPool without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetAgentPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()); - client.innerApiCalls.getAgentPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAgentPool( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getAgentPool with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetAgentPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getAgentPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAgentPool(request), expectedError); - assert((client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getAgentPool with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.GetAgentPoolRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAgentPool(request), expectedError); - }); - }); - - describe('deleteAgentPool', () => { - it('invokes deleteAgentPool without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteAgentPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAgentPool = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAgentPool(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteAgentPool without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteAgentPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAgentPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAgentPool( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteAgentPool with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteAgentPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAgentPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAgentPool(request), expectedError); - assert((client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteAgentPool with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.DeleteAgentPoolRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAgentPool(request), expectedError); - }); - }); - - describe('runTransferJob', () => { - it('invokes runTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.RunTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runTransferJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.runTransferJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.RunTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runTransferJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runTransferJob( - 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.runTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes runTransferJob with call error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.RunTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runTransferJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runTransferJob(request), expectedError); - assert((client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runTransferJob with LRO error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.RunTransferJobRequest()); - request.jobName = ''; - const expectedHeaderRequestParams = "job_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runTransferJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runTransferJob(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRunTransferJobProgress without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - 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.checkRunTransferJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunTransferJobProgress with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - 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.checkRunTransferJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listTransferJobs', () => { - it('invokes listTransferJobs without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - ]; - client.innerApiCalls.listTransferJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listTransferJobs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listTransferJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listTransferJobs without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - ]; - client.innerApiCalls.listTransferJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTransferJobs( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listTransferJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listTransferJobs with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; - const expectedError = new Error('expected'); - client.innerApiCalls.listTransferJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTransferJobs(request), expectedError); - assert((client.innerApiCalls.listTransferJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listTransferJobsStream without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - ]; - client.descriptors.page.listTransferJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTransferJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.storagetransfer.v1.TransferJob[] = []; - stream.on('data', (response: protos.google.storagetransfer.v1.TransferJob) => { - 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.listTransferJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTransferJobs, request)); - }); - - it('invokes listTransferJobsStream with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); - const expectedError = new Error('expected'); - client.descriptors.page.listTransferJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTransferJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.storagetransfer.v1.TransferJob[] = []; - stream.on('data', (response: protos.google.storagetransfer.v1.TransferJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTransferJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTransferJobs, request)); - }); - - it('uses async iteration with listTransferJobs without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest()); - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - ]; - client.descriptors.page.listTransferJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.storagetransfer.v1.ITransferJob[] = []; - const iterable = client.listTransferJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTransferJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listTransferJobs with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListTransferJobsRequest());const expectedError = new Error('expected'); - client.descriptors.page.listTransferJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTransferJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.storagetransfer.v1.ITransferJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTransferJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listAgentPools', () => { - it('invokes listAgentPools without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - ]; - client.innerApiCalls.listAgentPools = stubSimpleCall(expectedResponse); - const [response] = await client.listAgentPools(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAgentPools without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - ]; - client.innerApiCalls.listAgentPools = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAgentPools( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listAgentPools with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listAgentPools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAgentPools(request), expectedError); - assert((client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAgentPoolsStream without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - ]; - client.descriptors.page.listAgentPools.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAgentPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.storagetransfer.v1.AgentPool[] = []; - stream.on('data', (response: protos.google.storagetransfer.v1.AgentPool) => { - 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.listAgentPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAgentPools, request)); - assert.strictEqual( - (client.descriptors.page.listAgentPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listAgentPoolsStream with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedError = new Error('expected'); - client.descriptors.page.listAgentPools.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAgentPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.storagetransfer.v1.AgentPool[] = []; - stream.on('data', (response: protos.google.storagetransfer.v1.AgentPool) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAgentPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAgentPools, request)); - assert.strictEqual( - (client.descriptors.page.listAgentPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAgentPools without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id="; - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - ]; - client.descriptors.page.listAgentPools.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.storagetransfer.v1.IAgentPool[] = []; - const iterable = client.listAgentPoolsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAgentPools with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.storagetransfer.v1.ListAgentPoolsRequest()); - request.projectId = ''; - const expectedHeaderRequestParams = "project_id=";const expectedError = new Error('expected'); - client.descriptors.page.listAgentPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAgentPoolsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.storagetransfer.v1.IAgentPool[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('agentPools', () => { - const fakePath = "/rendered/path/agentPools"; - const expectedParameters = { - project_id: "projectIdValue", - agent_pool_id: "agentPoolIdValue", - }; - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.agentPoolsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.agentPoolsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('agentPoolsPath', () => { - const result = client.agentPoolsPath("projectIdValue", "agentPoolIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.agentPoolsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectIdFromAgentPoolsName', () => { - const result = client.matchProjectIdFromAgentPoolsName(fakePath); - assert.strictEqual(result, "projectIdValue"); - assert((client.pathTemplates.agentPoolsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAgentPoolIdFromAgentPoolsName', () => { - const result = client.matchAgentPoolIdFromAgentPoolsName(fakePath); - assert.strictEqual(result, "agentPoolIdValue"); - assert((client.pathTemplates.agentPoolsPathTemplate.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 08a3efc..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: 'StorageTransferService', - filename: './storage-transfer-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/protos/google/storagetransfer/v1/transfer.proto b/protos/google/storagetransfer/v1/transfer.proto index 5ee7211..802cc10 100644 --- a/protos/google/storagetransfer/v1/transfer.proto +++ b/protos/google/storagetransfer/v1/transfer.proto @@ -120,6 +120,14 @@ service StorageTransferService { }; } + // Deletes a transfer job. Deleting a transfer job sets its status to + // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. + rpc DeleteTransferJob(DeleteTransferJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{job_name=transferJobs/**}" + }; + } + // Creates an agent pool resource. rpc CreateAgentPool(CreateAgentPoolRequest) returns (AgentPool) { option (google.api.http) = { @@ -194,7 +202,7 @@ message UpdateTransferJobRequest { // other fields are rejected with the error // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. Updating a job status // to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED] requires - // `storagetransfer.jobs.delete` permissions. + // `storagetransfer.jobs.delete` permission. TransferJob transfer_job = 3 [(google.api.field_behavior) = REQUIRED]; // The field mask of the fields in `transferJob` that are to be updated in @@ -220,6 +228,16 @@ message GetTransferJobRequest { string project_id = 2 [(google.api.field_behavior) = REQUIRED]; } +// Request passed to DeleteTransferJob. +message DeleteTransferJobRequest { + // Required. The job to delete. + string job_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the Google Cloud project that owns the + // job. + string project_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + // `projectId`, `jobNames`, and `jobStatuses` are query parameters that can // be specified when listing transfer jobs. message ListTransferJobsRequest { diff --git a/protos/google/storagetransfer/v1/transfer_types.proto b/protos/google/storagetransfer/v1/transfer_types.proto index cfb87a6..4e1a3b5 100644 --- a/protos/google/storagetransfer/v1/transfer_types.proto +++ b/protos/google/storagetransfer/v1/transfer_types.proto @@ -319,6 +319,108 @@ message PosixFilesystem { string root_directory = 1; } +// An AwsS3CompatibleData resource. +message AwsS3CompatibleData { + // Required. Specifies the name of the bucket. + string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the root path to transfer objects. + // + // Must be an empty string or full path name that ends with a '/'. This + // field is treated as an object prefix. As such, it should generally not + // begin with a '/'. + string path = 2; + + // Required. Specifies the endpoint of the storage service. + string endpoint = 3 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the region to sign requests with. This can be left blank if + // requests should be signed with an empty region. + string region = 5; + + // Specifies the metadata of the S3 compatible data provider. Each provider + // may contain some attributes that do not apply to all S3-compatible data + // providers. When not specified, S3CompatibleMetadata is used by default. + oneof data_provider { + // A S3 compatible metadata. + S3CompatibleMetadata s3_metadata = 4; + } +} + +// S3CompatibleMetadata contains the metadata fields that apply to the basic +// types of S3-compatible data providers. +message S3CompatibleMetadata { + // The authentication and authorization method used by the storage service. + enum AuthMethod { + // AuthMethod is not specified. + AUTH_METHOD_UNSPECIFIED = 0; + + // Auth requests with AWS SigV4. + AUTH_METHOD_AWS_SIGNATURE_V4 = 1; + + // Auth requests with AWS SigV2. + AUTH_METHOD_AWS_SIGNATURE_V2 = 2; + } + + // The request model of the API. + enum RequestModel { + // RequestModel is not specified. + REQUEST_MODEL_UNSPECIFIED = 0; + + // Perform requests using Virtual Hosted Style. + // Example: https://bucket-name.s3.region.amazonaws.com/key-name + REQUEST_MODEL_VIRTUAL_HOSTED_STYLE = 1; + + // Perform requests using Path Style. + // Example: https://s3.region.amazonaws.com/bucket-name/key-name + REQUEST_MODEL_PATH_STYLE = 2; + } + + // The agent network protocol to access the storage service. + enum NetworkProtocol { + // NetworkProtocol is not specified. + NETWORK_PROTOCOL_UNSPECIFIED = 0; + + // Perform requests using HTTPS. + NETWORK_PROTOCOL_HTTPS = 1; + + // Not recommended: This sends data in clear-text. This is only + // appropriate within a closed network or for publicly available data. + // Perform requests using HTTP. + NETWORK_PROTOCOL_HTTP = 2; + } + + // The Listing API to use for discovering objects. + enum ListApi { + // ListApi is not specified. + LIST_API_UNSPECIFIED = 0; + + // Perform listing using ListObjectsV2 API. + LIST_OBJECTS_V2 = 1; + + // Legacy ListObjects API. + LIST_OBJECTS = 2; + } + + // Specifies the authentication and authorization method used by the storage + // service. When not specified, Transfer Service will attempt to determine + // right auth method to use. + AuthMethod auth_method = 1; + + // Specifies the API request model used to call the storage service. When not + // specified, the default value of RequestModel + // REQUEST_MODEL_VIRTUAL_HOSTED_STYLE is used. + RequestModel request_model = 2; + + // Specifies the network protocol of the agent. When not specified, the + // default value of NetworkProtocol NETWORK_PROTOCOL_HTTPS is used. + NetworkProtocol protocol = 3; + + // The Listing API to use for discovering objects. When not specified, + // Transfer Service will attempt to determine the right API to use. + ListApi list_api = 4; +} + // Represents an On-Premises Agent pool. message AgentPool { option (google.api.resource) = { @@ -372,17 +474,19 @@ message TransferOptions { // Specifies when to overwrite an object in the sink when an object with // matching name is found in the source. enum OverwriteWhen { - // Indicate the option is not set. + // Overwrite behavior is unspecified. OVERWRITE_WHEN_UNSPECIFIED = 0; - // Overwrite destination object with source if the two objects are - // different. + // Overwrites destination objects with the source objects, only if the + // objects have the same name but different HTTP ETags or checksum values. DIFFERENT = 1; - // Never overwrite destination object. + // Never overwrites a destination object if a source object has the + // same name. In this case, the source object is not transferred. NEVER = 2; - // Always overwrite destination object. + // Always overwrite the destination object with the source object, even if + // the HTTP Etags or checksum values are the same. ALWAYS = 3; } @@ -405,13 +509,12 @@ message TransferOptions { // exclusive. bool delete_objects_from_source_after_transfer = 3; - // When to overwrite objects that already exist in the sink. If not set + // When to overwrite objects that already exist in the sink. If not set, // overwrite behavior is determined by // [overwrite_objects_already_existing_in_sink][google.storagetransfer.v1.TransferOptions.overwrite_objects_already_existing_in_sink]. OverwriteWhen overwrite_when = 4; - // Represents the selected metadata options for a transfer job. This feature - // is in Preview. + // Represents the selected metadata options for a transfer job. MetadataOptions metadata_options = 5; } @@ -442,6 +545,9 @@ message TransferSpec { // An Azure Blob Storage data source. AzureBlobStorageData azure_blob_storage_data_source = 8; + + // An AWS S3 compatible data source. + AwsS3CompatibleData aws_s3_compatible_data_source = 19; } // Represents a supported data container type which is required for transfer diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 0611e57..e7a2250 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -155,6 +155,20 @@ export namespace google { */ public runTransferJob(request: google.storagetransfer.v1.IRunTransferJobRequest): Promise; + /** + * Calls DeleteTransferJob. + * @param request DeleteTransferJobRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteTransferJob(request: google.storagetransfer.v1.IDeleteTransferJobRequest, callback: google.storagetransfer.v1.StorageTransferService.DeleteTransferJobCallback): void; + + /** + * Calls DeleteTransferJob. + * @param request DeleteTransferJobRequest message or plain object + * @returns Promise + */ + public deleteTransferJob(request: google.storagetransfer.v1.IDeleteTransferJobRequest): Promise; + /** * Calls CreateAgentPool. * @param request CreateAgentPoolRequest message or plain object @@ -284,6 +298,13 @@ export namespace google { */ type RunTransferJobCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.storagetransfer.v1.StorageTransferService|deleteTransferJob}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteTransferJobCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + /** * Callback as used by {@link google.storagetransfer.v1.StorageTransferService|createAgentPool}. * @param error Error, if any @@ -732,6 +753,109 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a DeleteTransferJobRequest. */ + interface IDeleteTransferJobRequest { + + /** DeleteTransferJobRequest jobName */ + jobName?: (string|null); + + /** DeleteTransferJobRequest projectId */ + projectId?: (string|null); + } + + /** Represents a DeleteTransferJobRequest. */ + class DeleteTransferJobRequest implements IDeleteTransferJobRequest { + + /** + * Constructs a new DeleteTransferJobRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.storagetransfer.v1.IDeleteTransferJobRequest); + + /** DeleteTransferJobRequest jobName. */ + public jobName: string; + + /** DeleteTransferJobRequest projectId. */ + public projectId: string; + + /** + * Creates a new DeleteTransferJobRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteTransferJobRequest instance + */ + public static create(properties?: google.storagetransfer.v1.IDeleteTransferJobRequest): google.storagetransfer.v1.DeleteTransferJobRequest; + + /** + * Encodes the specified DeleteTransferJobRequest message. Does not implicitly {@link google.storagetransfer.v1.DeleteTransferJobRequest.verify|verify} messages. + * @param message DeleteTransferJobRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.storagetransfer.v1.IDeleteTransferJobRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteTransferJobRequest message, length delimited. Does not implicitly {@link google.storagetransfer.v1.DeleteTransferJobRequest.verify|verify} messages. + * @param message DeleteTransferJobRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.storagetransfer.v1.IDeleteTransferJobRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteTransferJobRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteTransferJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.storagetransfer.v1.DeleteTransferJobRequest; + + /** + * Decodes a DeleteTransferJobRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteTransferJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.storagetransfer.v1.DeleteTransferJobRequest; + + /** + * Verifies a DeleteTransferJobRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteTransferJobRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteTransferJobRequest + */ + public static fromObject(object: { [k: string]: any }): google.storagetransfer.v1.DeleteTransferJobRequest; + + /** + * Creates a plain object from a DeleteTransferJobRequest message. Also converts values to other types if specified. + * @param message DeleteTransferJobRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.storagetransfer.v1.DeleteTransferJobRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteTransferJobRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteTransferJobRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a ListTransferJobsRequest. */ interface IListTransferJobsRequest { @@ -2822,6 +2946,276 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of an AwsS3CompatibleData. */ + interface IAwsS3CompatibleData { + + /** AwsS3CompatibleData bucketName */ + bucketName?: (string|null); + + /** AwsS3CompatibleData path */ + path?: (string|null); + + /** AwsS3CompatibleData endpoint */ + endpoint?: (string|null); + + /** AwsS3CompatibleData region */ + region?: (string|null); + + /** AwsS3CompatibleData s3Metadata */ + s3Metadata?: (google.storagetransfer.v1.IS3CompatibleMetadata|null); + } + + /** Represents an AwsS3CompatibleData. */ + class AwsS3CompatibleData implements IAwsS3CompatibleData { + + /** + * Constructs a new AwsS3CompatibleData. + * @param [properties] Properties to set + */ + constructor(properties?: google.storagetransfer.v1.IAwsS3CompatibleData); + + /** AwsS3CompatibleData bucketName. */ + public bucketName: string; + + /** AwsS3CompatibleData path. */ + public path: string; + + /** AwsS3CompatibleData endpoint. */ + public endpoint: string; + + /** AwsS3CompatibleData region. */ + public region: string; + + /** AwsS3CompatibleData s3Metadata. */ + public s3Metadata?: (google.storagetransfer.v1.IS3CompatibleMetadata|null); + + /** AwsS3CompatibleData dataProvider. */ + public dataProvider?: "s3Metadata"; + + /** + * Creates a new AwsS3CompatibleData instance using the specified properties. + * @param [properties] Properties to set + * @returns AwsS3CompatibleData instance + */ + public static create(properties?: google.storagetransfer.v1.IAwsS3CompatibleData): google.storagetransfer.v1.AwsS3CompatibleData; + + /** + * Encodes the specified AwsS3CompatibleData message. Does not implicitly {@link google.storagetransfer.v1.AwsS3CompatibleData.verify|verify} messages. + * @param message AwsS3CompatibleData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.storagetransfer.v1.IAwsS3CompatibleData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AwsS3CompatibleData message, length delimited. Does not implicitly {@link google.storagetransfer.v1.AwsS3CompatibleData.verify|verify} messages. + * @param message AwsS3CompatibleData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.storagetransfer.v1.IAwsS3CompatibleData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AwsS3CompatibleData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AwsS3CompatibleData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.storagetransfer.v1.AwsS3CompatibleData; + + /** + * Decodes an AwsS3CompatibleData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AwsS3CompatibleData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.storagetransfer.v1.AwsS3CompatibleData; + + /** + * Verifies an AwsS3CompatibleData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AwsS3CompatibleData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AwsS3CompatibleData + */ + public static fromObject(object: { [k: string]: any }): google.storagetransfer.v1.AwsS3CompatibleData; + + /** + * Creates a plain object from an AwsS3CompatibleData message. Also converts values to other types if specified. + * @param message AwsS3CompatibleData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.storagetransfer.v1.AwsS3CompatibleData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AwsS3CompatibleData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AwsS3CompatibleData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a S3CompatibleMetadata. */ + interface IS3CompatibleMetadata { + + /** S3CompatibleMetadata authMethod */ + authMethod?: (google.storagetransfer.v1.S3CompatibleMetadata.AuthMethod|keyof typeof google.storagetransfer.v1.S3CompatibleMetadata.AuthMethod|null); + + /** S3CompatibleMetadata requestModel */ + requestModel?: (google.storagetransfer.v1.S3CompatibleMetadata.RequestModel|keyof typeof google.storagetransfer.v1.S3CompatibleMetadata.RequestModel|null); + + /** S3CompatibleMetadata protocol */ + protocol?: (google.storagetransfer.v1.S3CompatibleMetadata.NetworkProtocol|keyof typeof google.storagetransfer.v1.S3CompatibleMetadata.NetworkProtocol|null); + + /** S3CompatibleMetadata listApi */ + listApi?: (google.storagetransfer.v1.S3CompatibleMetadata.ListApi|keyof typeof google.storagetransfer.v1.S3CompatibleMetadata.ListApi|null); + } + + /** Represents a S3CompatibleMetadata. */ + class S3CompatibleMetadata implements IS3CompatibleMetadata { + + /** + * Constructs a new S3CompatibleMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.storagetransfer.v1.IS3CompatibleMetadata); + + /** S3CompatibleMetadata authMethod. */ + public authMethod: (google.storagetransfer.v1.S3CompatibleMetadata.AuthMethod|keyof typeof google.storagetransfer.v1.S3CompatibleMetadata.AuthMethod); + + /** S3CompatibleMetadata requestModel. */ + public requestModel: (google.storagetransfer.v1.S3CompatibleMetadata.RequestModel|keyof typeof google.storagetransfer.v1.S3CompatibleMetadata.RequestModel); + + /** S3CompatibleMetadata protocol. */ + public protocol: (google.storagetransfer.v1.S3CompatibleMetadata.NetworkProtocol|keyof typeof google.storagetransfer.v1.S3CompatibleMetadata.NetworkProtocol); + + /** S3CompatibleMetadata listApi. */ + public listApi: (google.storagetransfer.v1.S3CompatibleMetadata.ListApi|keyof typeof google.storagetransfer.v1.S3CompatibleMetadata.ListApi); + + /** + * Creates a new S3CompatibleMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns S3CompatibleMetadata instance + */ + public static create(properties?: google.storagetransfer.v1.IS3CompatibleMetadata): google.storagetransfer.v1.S3CompatibleMetadata; + + /** + * Encodes the specified S3CompatibleMetadata message. Does not implicitly {@link google.storagetransfer.v1.S3CompatibleMetadata.verify|verify} messages. + * @param message S3CompatibleMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.storagetransfer.v1.IS3CompatibleMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified S3CompatibleMetadata message, length delimited. Does not implicitly {@link google.storagetransfer.v1.S3CompatibleMetadata.verify|verify} messages. + * @param message S3CompatibleMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.storagetransfer.v1.IS3CompatibleMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a S3CompatibleMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns S3CompatibleMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.storagetransfer.v1.S3CompatibleMetadata; + + /** + * Decodes a S3CompatibleMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns S3CompatibleMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.storagetransfer.v1.S3CompatibleMetadata; + + /** + * Verifies a S3CompatibleMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a S3CompatibleMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns S3CompatibleMetadata + */ + public static fromObject(object: { [k: string]: any }): google.storagetransfer.v1.S3CompatibleMetadata; + + /** + * Creates a plain object from a S3CompatibleMetadata message. Also converts values to other types if specified. + * @param message S3CompatibleMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.storagetransfer.v1.S3CompatibleMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this S3CompatibleMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for S3CompatibleMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace S3CompatibleMetadata { + + /** AuthMethod enum. */ + enum AuthMethod { + AUTH_METHOD_UNSPECIFIED = 0, + AUTH_METHOD_AWS_SIGNATURE_V4 = 1, + AUTH_METHOD_AWS_SIGNATURE_V2 = 2 + } + + /** RequestModel enum. */ + enum RequestModel { + REQUEST_MODEL_UNSPECIFIED = 0, + REQUEST_MODEL_VIRTUAL_HOSTED_STYLE = 1, + REQUEST_MODEL_PATH_STYLE = 2 + } + + /** NetworkProtocol enum. */ + enum NetworkProtocol { + NETWORK_PROTOCOL_UNSPECIFIED = 0, + NETWORK_PROTOCOL_HTTPS = 1, + NETWORK_PROTOCOL_HTTP = 2 + } + + /** ListApi enum. */ + enum ListApi { + LIST_API_UNSPECIFIED = 0, + LIST_OBJECTS_V2 = 1, + LIST_OBJECTS = 2 + } + } + /** Properties of an AgentPool. */ interface IAgentPool { @@ -3201,6 +3595,9 @@ export namespace google { /** TransferSpec azureBlobStorageDataSource */ azureBlobStorageDataSource?: (google.storagetransfer.v1.IAzureBlobStorageData|null); + /** TransferSpec awsS3CompatibleDataSource */ + awsS3CompatibleDataSource?: (google.storagetransfer.v1.IAwsS3CompatibleData|null); + /** TransferSpec gcsIntermediateDataLocation */ gcsIntermediateDataLocation?: (google.storagetransfer.v1.IGcsData|null); @@ -3250,6 +3647,9 @@ export namespace google { /** TransferSpec azureBlobStorageDataSource. */ public azureBlobStorageDataSource?: (google.storagetransfer.v1.IAzureBlobStorageData|null); + /** TransferSpec awsS3CompatibleDataSource. */ + public awsS3CompatibleDataSource?: (google.storagetransfer.v1.IAwsS3CompatibleData|null); + /** TransferSpec gcsIntermediateDataLocation. */ public gcsIntermediateDataLocation?: (google.storagetransfer.v1.IGcsData|null); @@ -3272,7 +3672,7 @@ export namespace google { public dataSink?: ("gcsDataSink"|"posixDataSink"); /** TransferSpec dataSource. */ - public dataSource?: ("gcsDataSource"|"awsS3DataSource"|"httpDataSource"|"posixDataSource"|"azureBlobStorageDataSource"); + public dataSource?: ("gcsDataSource"|"awsS3DataSource"|"httpDataSource"|"posixDataSource"|"azureBlobStorageDataSource"|"awsS3CompatibleDataSource"); /** TransferSpec intermediateDataLocation. */ public intermediateDataLocation?: "gcsIntermediateDataLocation"; diff --git a/protos/protos.js b/protos/protos.js index 0d43809..2d24ce1 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -353,6 +353,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.storagetransfer.v1.StorageTransferService|deleteTransferJob}. + * @memberof google.storagetransfer.v1.StorageTransferService + * @typedef DeleteTransferJobCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteTransferJob. + * @function deleteTransferJob + * @memberof google.storagetransfer.v1.StorageTransferService + * @instance + * @param {google.storagetransfer.v1.IDeleteTransferJobRequest} request DeleteTransferJobRequest message or plain object + * @param {google.storagetransfer.v1.StorageTransferService.DeleteTransferJobCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(StorageTransferService.prototype.deleteTransferJob = function deleteTransferJob(request, callback) { + return this.rpcCall(deleteTransferJob, $root.google.storagetransfer.v1.DeleteTransferJobRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteTransferJob" }); + + /** + * Calls DeleteTransferJob. + * @function deleteTransferJob + * @memberof google.storagetransfer.v1.StorageTransferService + * @instance + * @param {google.storagetransfer.v1.IDeleteTransferJobRequest} request DeleteTransferJobRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.storagetransfer.v1.StorageTransferService|createAgentPool}. * @memberof google.storagetransfer.v1.StorageTransferService @@ -1442,6 +1475,233 @@ return GetTransferJobRequest; })(); + v1.DeleteTransferJobRequest = (function() { + + /** + * Properties of a DeleteTransferJobRequest. + * @memberof google.storagetransfer.v1 + * @interface IDeleteTransferJobRequest + * @property {string|null} [jobName] DeleteTransferJobRequest jobName + * @property {string|null} [projectId] DeleteTransferJobRequest projectId + */ + + /** + * Constructs a new DeleteTransferJobRequest. + * @memberof google.storagetransfer.v1 + * @classdesc Represents a DeleteTransferJobRequest. + * @implements IDeleteTransferJobRequest + * @constructor + * @param {google.storagetransfer.v1.IDeleteTransferJobRequest=} [properties] Properties to set + */ + function DeleteTransferJobRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteTransferJobRequest jobName. + * @member {string} jobName + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @instance + */ + DeleteTransferJobRequest.prototype.jobName = ""; + + /** + * DeleteTransferJobRequest projectId. + * @member {string} projectId + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @instance + */ + DeleteTransferJobRequest.prototype.projectId = ""; + + /** + * Creates a new DeleteTransferJobRequest instance using the specified properties. + * @function create + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @static + * @param {google.storagetransfer.v1.IDeleteTransferJobRequest=} [properties] Properties to set + * @returns {google.storagetransfer.v1.DeleteTransferJobRequest} DeleteTransferJobRequest instance + */ + DeleteTransferJobRequest.create = function create(properties) { + return new DeleteTransferJobRequest(properties); + }; + + /** + * Encodes the specified DeleteTransferJobRequest message. Does not implicitly {@link google.storagetransfer.v1.DeleteTransferJobRequest.verify|verify} messages. + * @function encode + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @static + * @param {google.storagetransfer.v1.IDeleteTransferJobRequest} message DeleteTransferJobRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTransferJobRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.jobName != null && Object.hasOwnProperty.call(message, "jobName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.jobName); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + return writer; + }; + + /** + * Encodes the specified DeleteTransferJobRequest message, length delimited. Does not implicitly {@link google.storagetransfer.v1.DeleteTransferJobRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @static + * @param {google.storagetransfer.v1.IDeleteTransferJobRequest} message DeleteTransferJobRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTransferJobRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteTransferJobRequest message from the specified reader or buffer. + * @function decode + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.storagetransfer.v1.DeleteTransferJobRequest} DeleteTransferJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTransferJobRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.storagetransfer.v1.DeleteTransferJobRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.jobName = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteTransferJobRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.storagetransfer.v1.DeleteTransferJobRequest} DeleteTransferJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTransferJobRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteTransferJobRequest message. + * @function verify + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteTransferJobRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.jobName != null && message.hasOwnProperty("jobName")) + if (!$util.isString(message.jobName)) + return "jobName: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + return null; + }; + + /** + * Creates a DeleteTransferJobRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @static + * @param {Object.} object Plain object + * @returns {google.storagetransfer.v1.DeleteTransferJobRequest} DeleteTransferJobRequest + */ + DeleteTransferJobRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.storagetransfer.v1.DeleteTransferJobRequest) + return object; + var message = new $root.google.storagetransfer.v1.DeleteTransferJobRequest(); + if (object.jobName != null) + message.jobName = String(object.jobName); + if (object.projectId != null) + message.projectId = String(object.projectId); + return message; + }; + + /** + * Creates a plain object from a DeleteTransferJobRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @static + * @param {google.storagetransfer.v1.DeleteTransferJobRequest} message DeleteTransferJobRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteTransferJobRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.jobName = ""; + object.projectId = ""; + } + if (message.jobName != null && message.hasOwnProperty("jobName")) + object.jobName = message.jobName; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + return object; + }; + + /** + * Converts this DeleteTransferJobRequest to JSON. + * @function toJSON + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteTransferJobRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteTransferJobRequest + * @function getTypeUrl + * @memberof google.storagetransfer.v1.DeleteTransferJobRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteTransferJobRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.storagetransfer.v1.DeleteTransferJobRequest"; + }; + + return DeleteTransferJobRequest; + })(); + v1.ListTransferJobsRequest = (function() { /** @@ -6211,27 +6471,28 @@ return PosixFilesystem; })(); - v1.AgentPool = (function() { + v1.AwsS3CompatibleData = (function() { /** - * Properties of an AgentPool. + * Properties of an AwsS3CompatibleData. * @memberof google.storagetransfer.v1 - * @interface IAgentPool - * @property {string|null} [name] AgentPool name - * @property {string|null} [displayName] AgentPool displayName - * @property {google.storagetransfer.v1.AgentPool.State|null} [state] AgentPool state - * @property {google.storagetransfer.v1.AgentPool.IBandwidthLimit|null} [bandwidthLimit] AgentPool bandwidthLimit + * @interface IAwsS3CompatibleData + * @property {string|null} [bucketName] AwsS3CompatibleData bucketName + * @property {string|null} [path] AwsS3CompatibleData path + * @property {string|null} [endpoint] AwsS3CompatibleData endpoint + * @property {string|null} [region] AwsS3CompatibleData region + * @property {google.storagetransfer.v1.IS3CompatibleMetadata|null} [s3Metadata] AwsS3CompatibleData s3Metadata */ /** - * Constructs a new AgentPool. + * Constructs a new AwsS3CompatibleData. * @memberof google.storagetransfer.v1 - * @classdesc Represents an AgentPool. - * @implements IAgentPool + * @classdesc Represents an AwsS3CompatibleData. + * @implements IAwsS3CompatibleData * @constructor - * @param {google.storagetransfer.v1.IAgentPool=} [properties] Properties to set + * @param {google.storagetransfer.v1.IAwsS3CompatibleData=} [properties] Properties to set */ - function AgentPool(properties) { + function AwsS3CompatibleData(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6239,82 +6500,811 @@ } /** - * AgentPool name. - * @member {string} name - * @memberof google.storagetransfer.v1.AgentPool + * AwsS3CompatibleData bucketName. + * @member {string} bucketName + * @memberof google.storagetransfer.v1.AwsS3CompatibleData * @instance */ - AgentPool.prototype.name = ""; + AwsS3CompatibleData.prototype.bucketName = ""; /** - * AgentPool displayName. - * @member {string} displayName - * @memberof google.storagetransfer.v1.AgentPool + * AwsS3CompatibleData path. + * @member {string} path + * @memberof google.storagetransfer.v1.AwsS3CompatibleData * @instance */ - AgentPool.prototype.displayName = ""; + AwsS3CompatibleData.prototype.path = ""; /** - * AgentPool state. - * @member {google.storagetransfer.v1.AgentPool.State} state - * @memberof google.storagetransfer.v1.AgentPool + * AwsS3CompatibleData endpoint. + * @member {string} endpoint + * @memberof google.storagetransfer.v1.AwsS3CompatibleData * @instance */ - AgentPool.prototype.state = 0; + AwsS3CompatibleData.prototype.endpoint = ""; /** - * AgentPool bandwidthLimit. - * @member {google.storagetransfer.v1.AgentPool.IBandwidthLimit|null|undefined} bandwidthLimit - * @memberof google.storagetransfer.v1.AgentPool + * AwsS3CompatibleData region. + * @member {string} region + * @memberof google.storagetransfer.v1.AwsS3CompatibleData * @instance */ - AgentPool.prototype.bandwidthLimit = null; + AwsS3CompatibleData.prototype.region = ""; /** - * Creates a new AgentPool instance using the specified properties. + * AwsS3CompatibleData s3Metadata. + * @member {google.storagetransfer.v1.IS3CompatibleMetadata|null|undefined} s3Metadata + * @memberof google.storagetransfer.v1.AwsS3CompatibleData + * @instance + */ + AwsS3CompatibleData.prototype.s3Metadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AwsS3CompatibleData dataProvider. + * @member {"s3Metadata"|undefined} dataProvider + * @memberof google.storagetransfer.v1.AwsS3CompatibleData + * @instance + */ + Object.defineProperty(AwsS3CompatibleData.prototype, "dataProvider", { + get: $util.oneOfGetter($oneOfFields = ["s3Metadata"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AwsS3CompatibleData instance using the specified properties. * @function create - * @memberof google.storagetransfer.v1.AgentPool + * @memberof google.storagetransfer.v1.AwsS3CompatibleData * @static - * @param {google.storagetransfer.v1.IAgentPool=} [properties] Properties to set - * @returns {google.storagetransfer.v1.AgentPool} AgentPool instance + * @param {google.storagetransfer.v1.IAwsS3CompatibleData=} [properties] Properties to set + * @returns {google.storagetransfer.v1.AwsS3CompatibleData} AwsS3CompatibleData instance */ - AgentPool.create = function create(properties) { - return new AgentPool(properties); + AwsS3CompatibleData.create = function create(properties) { + return new AwsS3CompatibleData(properties); }; /** - * Encodes the specified AgentPool message. Does not implicitly {@link google.storagetransfer.v1.AgentPool.verify|verify} messages. + * Encodes the specified AwsS3CompatibleData message. Does not implicitly {@link google.storagetransfer.v1.AwsS3CompatibleData.verify|verify} messages. * @function encode - * @memberof google.storagetransfer.v1.AgentPool + * @memberof google.storagetransfer.v1.AwsS3CompatibleData * @static - * @param {google.storagetransfer.v1.IAgentPool} message AgentPool message or plain object to encode + * @param {google.storagetransfer.v1.IAwsS3CompatibleData} message AwsS3CompatibleData message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AgentPool.encode = function encode(message, writer) { + AwsS3CompatibleData.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); - if (message.bandwidthLimit != null && Object.hasOwnProperty.call(message, "bandwidthLimit")) - $root.google.storagetransfer.v1.AgentPool.BandwidthLimit.encode(message.bandwidthLimit, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.bucketName != null && Object.hasOwnProperty.call(message, "bucketName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.bucketName); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.endpoint); + if (message.s3Metadata != null && Object.hasOwnProperty.call(message, "s3Metadata")) + $root.google.storagetransfer.v1.S3CompatibleMetadata.encode(message.s3Metadata, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.region); return writer; }; /** - * Encodes the specified AgentPool message, length delimited. Does not implicitly {@link google.storagetransfer.v1.AgentPool.verify|verify} messages. + * Encodes the specified AwsS3CompatibleData message, length delimited. Does not implicitly {@link google.storagetransfer.v1.AwsS3CompatibleData.verify|verify} messages. * @function encodeDelimited - * @memberof google.storagetransfer.v1.AgentPool + * @memberof google.storagetransfer.v1.AwsS3CompatibleData * @static - * @param {google.storagetransfer.v1.IAgentPool} message AgentPool message or plain object to encode + * @param {google.storagetransfer.v1.IAwsS3CompatibleData} message AwsS3CompatibleData message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AgentPool.encodeDelimited = function encodeDelimited(message, writer) { + AwsS3CompatibleData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AwsS3CompatibleData message from the specified reader or buffer. + * @function decode + * @memberof google.storagetransfer.v1.AwsS3CompatibleData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.storagetransfer.v1.AwsS3CompatibleData} AwsS3CompatibleData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AwsS3CompatibleData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.storagetransfer.v1.AwsS3CompatibleData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.bucketName = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } + case 3: { + message.endpoint = reader.string(); + break; + } + case 5: { + message.region = reader.string(); + break; + } + case 4: { + message.s3Metadata = $root.google.storagetransfer.v1.S3CompatibleMetadata.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AwsS3CompatibleData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.storagetransfer.v1.AwsS3CompatibleData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.storagetransfer.v1.AwsS3CompatibleData} AwsS3CompatibleData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AwsS3CompatibleData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AwsS3CompatibleData message. + * @function verify + * @memberof google.storagetransfer.v1.AwsS3CompatibleData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AwsS3CompatibleData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.bucketName != null && message.hasOwnProperty("bucketName")) + if (!$util.isString(message.bucketName)) + return "bucketName: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + if (!$util.isString(message.endpoint)) + return "endpoint: string expected"; + if (message.region != null && message.hasOwnProperty("region")) + if (!$util.isString(message.region)) + return "region: string expected"; + if (message.s3Metadata != null && message.hasOwnProperty("s3Metadata")) { + properties.dataProvider = 1; + { + var error = $root.google.storagetransfer.v1.S3CompatibleMetadata.verify(message.s3Metadata); + if (error) + return "s3Metadata." + error; + } + } + return null; + }; + + /** + * Creates an AwsS3CompatibleData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.storagetransfer.v1.AwsS3CompatibleData + * @static + * @param {Object.} object Plain object + * @returns {google.storagetransfer.v1.AwsS3CompatibleData} AwsS3CompatibleData + */ + AwsS3CompatibleData.fromObject = function fromObject(object) { + if (object instanceof $root.google.storagetransfer.v1.AwsS3CompatibleData) + return object; + var message = new $root.google.storagetransfer.v1.AwsS3CompatibleData(); + if (object.bucketName != null) + message.bucketName = String(object.bucketName); + if (object.path != null) + message.path = String(object.path); + if (object.endpoint != null) + message.endpoint = String(object.endpoint); + if (object.region != null) + message.region = String(object.region); + if (object.s3Metadata != null) { + if (typeof object.s3Metadata !== "object") + throw TypeError(".google.storagetransfer.v1.AwsS3CompatibleData.s3Metadata: object expected"); + message.s3Metadata = $root.google.storagetransfer.v1.S3CompatibleMetadata.fromObject(object.s3Metadata); + } + return message; + }; + + /** + * Creates a plain object from an AwsS3CompatibleData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.storagetransfer.v1.AwsS3CompatibleData + * @static + * @param {google.storagetransfer.v1.AwsS3CompatibleData} message AwsS3CompatibleData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AwsS3CompatibleData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.bucketName = ""; + object.path = ""; + object.endpoint = ""; + object.region = ""; + } + if (message.bucketName != null && message.hasOwnProperty("bucketName")) + object.bucketName = message.bucketName; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + object.endpoint = message.endpoint; + if (message.s3Metadata != null && message.hasOwnProperty("s3Metadata")) { + object.s3Metadata = $root.google.storagetransfer.v1.S3CompatibleMetadata.toObject(message.s3Metadata, options); + if (options.oneofs) + object.dataProvider = "s3Metadata"; + } + if (message.region != null && message.hasOwnProperty("region")) + object.region = message.region; + return object; + }; + + /** + * Converts this AwsS3CompatibleData to JSON. + * @function toJSON + * @memberof google.storagetransfer.v1.AwsS3CompatibleData + * @instance + * @returns {Object.} JSON object + */ + AwsS3CompatibleData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AwsS3CompatibleData + * @function getTypeUrl + * @memberof google.storagetransfer.v1.AwsS3CompatibleData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AwsS3CompatibleData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.storagetransfer.v1.AwsS3CompatibleData"; + }; + + return AwsS3CompatibleData; + })(); + + v1.S3CompatibleMetadata = (function() { + + /** + * Properties of a S3CompatibleMetadata. + * @memberof google.storagetransfer.v1 + * @interface IS3CompatibleMetadata + * @property {google.storagetransfer.v1.S3CompatibleMetadata.AuthMethod|null} [authMethod] S3CompatibleMetadata authMethod + * @property {google.storagetransfer.v1.S3CompatibleMetadata.RequestModel|null} [requestModel] S3CompatibleMetadata requestModel + * @property {google.storagetransfer.v1.S3CompatibleMetadata.NetworkProtocol|null} [protocol] S3CompatibleMetadata protocol + * @property {google.storagetransfer.v1.S3CompatibleMetadata.ListApi|null} [listApi] S3CompatibleMetadata listApi + */ + + /** + * Constructs a new S3CompatibleMetadata. + * @memberof google.storagetransfer.v1 + * @classdesc Represents a S3CompatibleMetadata. + * @implements IS3CompatibleMetadata + * @constructor + * @param {google.storagetransfer.v1.IS3CompatibleMetadata=} [properties] Properties to set + */ + function S3CompatibleMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * S3CompatibleMetadata authMethod. + * @member {google.storagetransfer.v1.S3CompatibleMetadata.AuthMethod} authMethod + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @instance + */ + S3CompatibleMetadata.prototype.authMethod = 0; + + /** + * S3CompatibleMetadata requestModel. + * @member {google.storagetransfer.v1.S3CompatibleMetadata.RequestModel} requestModel + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @instance + */ + S3CompatibleMetadata.prototype.requestModel = 0; + + /** + * S3CompatibleMetadata protocol. + * @member {google.storagetransfer.v1.S3CompatibleMetadata.NetworkProtocol} protocol + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @instance + */ + S3CompatibleMetadata.prototype.protocol = 0; + + /** + * S3CompatibleMetadata listApi. + * @member {google.storagetransfer.v1.S3CompatibleMetadata.ListApi} listApi + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @instance + */ + S3CompatibleMetadata.prototype.listApi = 0; + + /** + * Creates a new S3CompatibleMetadata instance using the specified properties. + * @function create + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @static + * @param {google.storagetransfer.v1.IS3CompatibleMetadata=} [properties] Properties to set + * @returns {google.storagetransfer.v1.S3CompatibleMetadata} S3CompatibleMetadata instance + */ + S3CompatibleMetadata.create = function create(properties) { + return new S3CompatibleMetadata(properties); + }; + + /** + * Encodes the specified S3CompatibleMetadata message. Does not implicitly {@link google.storagetransfer.v1.S3CompatibleMetadata.verify|verify} messages. + * @function encode + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @static + * @param {google.storagetransfer.v1.IS3CompatibleMetadata} message S3CompatibleMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + S3CompatibleMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.authMethod != null && Object.hasOwnProperty.call(message, "authMethod")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.authMethod); + if (message.requestModel != null && Object.hasOwnProperty.call(message, "requestModel")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.requestModel); + if (message.protocol != null && Object.hasOwnProperty.call(message, "protocol")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.protocol); + if (message.listApi != null && Object.hasOwnProperty.call(message, "listApi")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.listApi); + return writer; + }; + + /** + * Encodes the specified S3CompatibleMetadata message, length delimited. Does not implicitly {@link google.storagetransfer.v1.S3CompatibleMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @static + * @param {google.storagetransfer.v1.IS3CompatibleMetadata} message S3CompatibleMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + S3CompatibleMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a S3CompatibleMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.storagetransfer.v1.S3CompatibleMetadata} S3CompatibleMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + S3CompatibleMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.storagetransfer.v1.S3CompatibleMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.authMethod = reader.int32(); + break; + } + case 2: { + message.requestModel = reader.int32(); + break; + } + case 3: { + message.protocol = reader.int32(); + break; + } + case 4: { + message.listApi = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a S3CompatibleMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.storagetransfer.v1.S3CompatibleMetadata} S3CompatibleMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + S3CompatibleMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a S3CompatibleMetadata message. + * @function verify + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + S3CompatibleMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.authMethod != null && message.hasOwnProperty("authMethod")) + switch (message.authMethod) { + default: + return "authMethod: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.requestModel != null && message.hasOwnProperty("requestModel")) + switch (message.requestModel) { + default: + return "requestModel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.protocol != null && message.hasOwnProperty("protocol")) + switch (message.protocol) { + default: + return "protocol: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.listApi != null && message.hasOwnProperty("listApi")) + switch (message.listApi) { + default: + return "listApi: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a S3CompatibleMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.storagetransfer.v1.S3CompatibleMetadata} S3CompatibleMetadata + */ + S3CompatibleMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.storagetransfer.v1.S3CompatibleMetadata) + return object; + var message = new $root.google.storagetransfer.v1.S3CompatibleMetadata(); + switch (object.authMethod) { + case "AUTH_METHOD_UNSPECIFIED": + case 0: + message.authMethod = 0; + break; + case "AUTH_METHOD_AWS_SIGNATURE_V4": + case 1: + message.authMethod = 1; + break; + case "AUTH_METHOD_AWS_SIGNATURE_V2": + case 2: + message.authMethod = 2; + break; + } + switch (object.requestModel) { + case "REQUEST_MODEL_UNSPECIFIED": + case 0: + message.requestModel = 0; + break; + case "REQUEST_MODEL_VIRTUAL_HOSTED_STYLE": + case 1: + message.requestModel = 1; + break; + case "REQUEST_MODEL_PATH_STYLE": + case 2: + message.requestModel = 2; + break; + } + switch (object.protocol) { + case "NETWORK_PROTOCOL_UNSPECIFIED": + case 0: + message.protocol = 0; + break; + case "NETWORK_PROTOCOL_HTTPS": + case 1: + message.protocol = 1; + break; + case "NETWORK_PROTOCOL_HTTP": + case 2: + message.protocol = 2; + break; + } + switch (object.listApi) { + case "LIST_API_UNSPECIFIED": + case 0: + message.listApi = 0; + break; + case "LIST_OBJECTS_V2": + case 1: + message.listApi = 1; + break; + case "LIST_OBJECTS": + case 2: + message.listApi = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a S3CompatibleMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @static + * @param {google.storagetransfer.v1.S3CompatibleMetadata} message S3CompatibleMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + S3CompatibleMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.authMethod = options.enums === String ? "AUTH_METHOD_UNSPECIFIED" : 0; + object.requestModel = options.enums === String ? "REQUEST_MODEL_UNSPECIFIED" : 0; + object.protocol = options.enums === String ? "NETWORK_PROTOCOL_UNSPECIFIED" : 0; + object.listApi = options.enums === String ? "LIST_API_UNSPECIFIED" : 0; + } + if (message.authMethod != null && message.hasOwnProperty("authMethod")) + object.authMethod = options.enums === String ? $root.google.storagetransfer.v1.S3CompatibleMetadata.AuthMethod[message.authMethod] : message.authMethod; + if (message.requestModel != null && message.hasOwnProperty("requestModel")) + object.requestModel = options.enums === String ? $root.google.storagetransfer.v1.S3CompatibleMetadata.RequestModel[message.requestModel] : message.requestModel; + if (message.protocol != null && message.hasOwnProperty("protocol")) + object.protocol = options.enums === String ? $root.google.storagetransfer.v1.S3CompatibleMetadata.NetworkProtocol[message.protocol] : message.protocol; + if (message.listApi != null && message.hasOwnProperty("listApi")) + object.listApi = options.enums === String ? $root.google.storagetransfer.v1.S3CompatibleMetadata.ListApi[message.listApi] : message.listApi; + return object; + }; + + /** + * Converts this S3CompatibleMetadata to JSON. + * @function toJSON + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @instance + * @returns {Object.} JSON object + */ + S3CompatibleMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for S3CompatibleMetadata + * @function getTypeUrl + * @memberof google.storagetransfer.v1.S3CompatibleMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + S3CompatibleMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.storagetransfer.v1.S3CompatibleMetadata"; + }; + + /** + * AuthMethod enum. + * @name google.storagetransfer.v1.S3CompatibleMetadata.AuthMethod + * @enum {number} + * @property {number} AUTH_METHOD_UNSPECIFIED=0 AUTH_METHOD_UNSPECIFIED value + * @property {number} AUTH_METHOD_AWS_SIGNATURE_V4=1 AUTH_METHOD_AWS_SIGNATURE_V4 value + * @property {number} AUTH_METHOD_AWS_SIGNATURE_V2=2 AUTH_METHOD_AWS_SIGNATURE_V2 value + */ + S3CompatibleMetadata.AuthMethod = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUTH_METHOD_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTH_METHOD_AWS_SIGNATURE_V4"] = 1; + values[valuesById[2] = "AUTH_METHOD_AWS_SIGNATURE_V2"] = 2; + return values; + })(); + + /** + * RequestModel enum. + * @name google.storagetransfer.v1.S3CompatibleMetadata.RequestModel + * @enum {number} + * @property {number} REQUEST_MODEL_UNSPECIFIED=0 REQUEST_MODEL_UNSPECIFIED value + * @property {number} REQUEST_MODEL_VIRTUAL_HOSTED_STYLE=1 REQUEST_MODEL_VIRTUAL_HOSTED_STYLE value + * @property {number} REQUEST_MODEL_PATH_STYLE=2 REQUEST_MODEL_PATH_STYLE value + */ + S3CompatibleMetadata.RequestModel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REQUEST_MODEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "REQUEST_MODEL_VIRTUAL_HOSTED_STYLE"] = 1; + values[valuesById[2] = "REQUEST_MODEL_PATH_STYLE"] = 2; + return values; + })(); + + /** + * NetworkProtocol enum. + * @name google.storagetransfer.v1.S3CompatibleMetadata.NetworkProtocol + * @enum {number} + * @property {number} NETWORK_PROTOCOL_UNSPECIFIED=0 NETWORK_PROTOCOL_UNSPECIFIED value + * @property {number} NETWORK_PROTOCOL_HTTPS=1 NETWORK_PROTOCOL_HTTPS value + * @property {number} NETWORK_PROTOCOL_HTTP=2 NETWORK_PROTOCOL_HTTP value + */ + S3CompatibleMetadata.NetworkProtocol = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NETWORK_PROTOCOL_UNSPECIFIED"] = 0; + values[valuesById[1] = "NETWORK_PROTOCOL_HTTPS"] = 1; + values[valuesById[2] = "NETWORK_PROTOCOL_HTTP"] = 2; + return values; + })(); + + /** + * ListApi enum. + * @name google.storagetransfer.v1.S3CompatibleMetadata.ListApi + * @enum {number} + * @property {number} LIST_API_UNSPECIFIED=0 LIST_API_UNSPECIFIED value + * @property {number} LIST_OBJECTS_V2=1 LIST_OBJECTS_V2 value + * @property {number} LIST_OBJECTS=2 LIST_OBJECTS value + */ + S3CompatibleMetadata.ListApi = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LIST_API_UNSPECIFIED"] = 0; + values[valuesById[1] = "LIST_OBJECTS_V2"] = 1; + values[valuesById[2] = "LIST_OBJECTS"] = 2; + return values; + })(); + + return S3CompatibleMetadata; + })(); + + v1.AgentPool = (function() { + + /** + * Properties of an AgentPool. + * @memberof google.storagetransfer.v1 + * @interface IAgentPool + * @property {string|null} [name] AgentPool name + * @property {string|null} [displayName] AgentPool displayName + * @property {google.storagetransfer.v1.AgentPool.State|null} [state] AgentPool state + * @property {google.storagetransfer.v1.AgentPool.IBandwidthLimit|null} [bandwidthLimit] AgentPool bandwidthLimit + */ + + /** + * Constructs a new AgentPool. + * @memberof google.storagetransfer.v1 + * @classdesc Represents an AgentPool. + * @implements IAgentPool + * @constructor + * @param {google.storagetransfer.v1.IAgentPool=} [properties] Properties to set + */ + function AgentPool(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AgentPool name. + * @member {string} name + * @memberof google.storagetransfer.v1.AgentPool + * @instance + */ + AgentPool.prototype.name = ""; + + /** + * AgentPool displayName. + * @member {string} displayName + * @memberof google.storagetransfer.v1.AgentPool + * @instance + */ + AgentPool.prototype.displayName = ""; + + /** + * AgentPool state. + * @member {google.storagetransfer.v1.AgentPool.State} state + * @memberof google.storagetransfer.v1.AgentPool + * @instance + */ + AgentPool.prototype.state = 0; + + /** + * AgentPool bandwidthLimit. + * @member {google.storagetransfer.v1.AgentPool.IBandwidthLimit|null|undefined} bandwidthLimit + * @memberof google.storagetransfer.v1.AgentPool + * @instance + */ + AgentPool.prototype.bandwidthLimit = null; + + /** + * Creates a new AgentPool instance using the specified properties. + * @function create + * @memberof google.storagetransfer.v1.AgentPool + * @static + * @param {google.storagetransfer.v1.IAgentPool=} [properties] Properties to set + * @returns {google.storagetransfer.v1.AgentPool} AgentPool instance + */ + AgentPool.create = function create(properties) { + return new AgentPool(properties); + }; + + /** + * Encodes the specified AgentPool message. Does not implicitly {@link google.storagetransfer.v1.AgentPool.verify|verify} messages. + * @function encode + * @memberof google.storagetransfer.v1.AgentPool + * @static + * @param {google.storagetransfer.v1.IAgentPool} message AgentPool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentPool.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.bandwidthLimit != null && Object.hasOwnProperty.call(message, "bandwidthLimit")) + $root.google.storagetransfer.v1.AgentPool.BandwidthLimit.encode(message.bandwidthLimit, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AgentPool message, length delimited. Does not implicitly {@link google.storagetransfer.v1.AgentPool.verify|verify} messages. + * @function encodeDelimited + * @memberof google.storagetransfer.v1.AgentPool + * @static + * @param {google.storagetransfer.v1.IAgentPool} message AgentPool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentPool.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -7102,6 +8092,7 @@ * @property {google.storagetransfer.v1.IHttpData|null} [httpDataSource] TransferSpec httpDataSource * @property {google.storagetransfer.v1.IPosixFilesystem|null} [posixDataSource] TransferSpec posixDataSource * @property {google.storagetransfer.v1.IAzureBlobStorageData|null} [azureBlobStorageDataSource] TransferSpec azureBlobStorageDataSource + * @property {google.storagetransfer.v1.IAwsS3CompatibleData|null} [awsS3CompatibleDataSource] TransferSpec awsS3CompatibleDataSource * @property {google.storagetransfer.v1.IGcsData|null} [gcsIntermediateDataLocation] TransferSpec gcsIntermediateDataLocation * @property {google.storagetransfer.v1.IObjectConditions|null} [objectConditions] TransferSpec objectConditions * @property {google.storagetransfer.v1.ITransferOptions|null} [transferOptions] TransferSpec transferOptions @@ -7181,6 +8172,14 @@ */ TransferSpec.prototype.azureBlobStorageDataSource = null; + /** + * TransferSpec awsS3CompatibleDataSource. + * @member {google.storagetransfer.v1.IAwsS3CompatibleData|null|undefined} awsS3CompatibleDataSource + * @memberof google.storagetransfer.v1.TransferSpec + * @instance + */ + TransferSpec.prototype.awsS3CompatibleDataSource = null; + /** * TransferSpec gcsIntermediateDataLocation. * @member {google.storagetransfer.v1.IGcsData|null|undefined} gcsIntermediateDataLocation @@ -7245,12 +8244,12 @@ /** * TransferSpec dataSource. - * @member {"gcsDataSource"|"awsS3DataSource"|"httpDataSource"|"posixDataSource"|"azureBlobStorageDataSource"|undefined} dataSource + * @member {"gcsDataSource"|"awsS3DataSource"|"httpDataSource"|"posixDataSource"|"azureBlobStorageDataSource"|"awsS3CompatibleDataSource"|undefined} dataSource * @memberof google.storagetransfer.v1.TransferSpec * @instance */ Object.defineProperty(TransferSpec.prototype, "dataSource", { - get: $util.oneOfGetter($oneOfFields = ["gcsDataSource", "awsS3DataSource", "httpDataSource", "posixDataSource", "azureBlobStorageDataSource"]), + get: $util.oneOfGetter($oneOfFields = ["gcsDataSource", "awsS3DataSource", "httpDataSource", "posixDataSource", "azureBlobStorageDataSource", "awsS3CompatibleDataSource"]), set: $util.oneOfSetter($oneOfFields) }); @@ -7315,6 +8314,8 @@ writer.uint32(/* id 17, wireType 2 =*/138).string(message.sourceAgentPoolName); if (message.sinkAgentPoolName != null && Object.hasOwnProperty.call(message, "sinkAgentPoolName")) writer.uint32(/* id 18, wireType 2 =*/146).string(message.sinkAgentPoolName); + if (message.awsS3CompatibleDataSource != null && Object.hasOwnProperty.call(message, "awsS3CompatibleDataSource")) + $root.google.storagetransfer.v1.AwsS3CompatibleData.encode(message.awsS3CompatibleDataSource, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); return writer; }; @@ -7377,6 +8378,10 @@ message.azureBlobStorageDataSource = $root.google.storagetransfer.v1.AzureBlobStorageData.decode(reader, reader.uint32()); break; } + case 19: { + message.awsS3CompatibleDataSource = $root.google.storagetransfer.v1.AwsS3CompatibleData.decode(reader, reader.uint32()); + break; + } case 16: { message.gcsIntermediateDataLocation = $root.google.storagetransfer.v1.GcsData.decode(reader, reader.uint32()); break; @@ -7503,6 +8508,16 @@ return "azureBlobStorageDataSource." + error; } } + if (message.awsS3CompatibleDataSource != null && message.hasOwnProperty("awsS3CompatibleDataSource")) { + if (properties.dataSource === 1) + return "dataSource: multiple values"; + properties.dataSource = 1; + { + var error = $root.google.storagetransfer.v1.AwsS3CompatibleData.verify(message.awsS3CompatibleDataSource); + if (error) + return "awsS3CompatibleDataSource." + error; + } + } if (message.gcsIntermediateDataLocation != null && message.hasOwnProperty("gcsIntermediateDataLocation")) { properties.intermediateDataLocation = 1; { @@ -7582,6 +8597,11 @@ throw TypeError(".google.storagetransfer.v1.TransferSpec.azureBlobStorageDataSource: object expected"); message.azureBlobStorageDataSource = $root.google.storagetransfer.v1.AzureBlobStorageData.fromObject(object.azureBlobStorageDataSource); } + if (object.awsS3CompatibleDataSource != null) { + if (typeof object.awsS3CompatibleDataSource !== "object") + throw TypeError(".google.storagetransfer.v1.TransferSpec.awsS3CompatibleDataSource: object expected"); + message.awsS3CompatibleDataSource = $root.google.storagetransfer.v1.AwsS3CompatibleData.fromObject(object.awsS3CompatibleDataSource); + } if (object.gcsIntermediateDataLocation != null) { if (typeof object.gcsIntermediateDataLocation !== "object") throw TypeError(".google.storagetransfer.v1.TransferSpec.gcsIntermediateDataLocation: object expected"); @@ -7679,6 +8699,11 @@ object.sourceAgentPoolName = message.sourceAgentPoolName; if (message.sinkAgentPoolName != null && message.hasOwnProperty("sinkAgentPoolName")) object.sinkAgentPoolName = message.sinkAgentPoolName; + if (message.awsS3CompatibleDataSource != null && message.hasOwnProperty("awsS3CompatibleDataSource")) { + object.awsS3CompatibleDataSource = $root.google.storagetransfer.v1.AwsS3CompatibleData.toObject(message.awsS3CompatibleDataSource, options); + if (options.oneofs) + object.dataSource = "awsS3CompatibleDataSource"; + } return object; }; diff --git a/protos/protos.json b/protos/protos.json index 6ab50bf..47e8e61 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -151,6 +151,20 @@ } ] }, + "DeleteTransferJob": { + "requestType": "DeleteTransferJobRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{job_name=transferJobs/**}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{job_name=transferJobs/**}" + } + } + ] + }, "CreateAgentPool": { "requestType": "CreateAgentPoolRequest", "responseType": "AgentPool", @@ -316,6 +330,24 @@ } } }, + "DeleteTransferJobRequest": { + "fields": { + "jobName": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "projectId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, "ListTransferJobsRequest": { "fields": { "filter": { @@ -646,6 +678,93 @@ } } }, + "AwsS3CompatibleData": { + "oneofs": { + "dataProvider": { + "oneof": [ + "s3Metadata" + ] + } + }, + "fields": { + "bucketName": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "path": { + "type": "string", + "id": 2 + }, + "endpoint": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "region": { + "type": "string", + "id": 5 + }, + "s3Metadata": { + "type": "S3CompatibleMetadata", + "id": 4 + } + } + }, + "S3CompatibleMetadata": { + "fields": { + "authMethod": { + "type": "AuthMethod", + "id": 1 + }, + "requestModel": { + "type": "RequestModel", + "id": 2 + }, + "protocol": { + "type": "NetworkProtocol", + "id": 3 + }, + "listApi": { + "type": "ListApi", + "id": 4 + } + }, + "nested": { + "AuthMethod": { + "values": { + "AUTH_METHOD_UNSPECIFIED": 0, + "AUTH_METHOD_AWS_SIGNATURE_V4": 1, + "AUTH_METHOD_AWS_SIGNATURE_V2": 2 + } + }, + "RequestModel": { + "values": { + "REQUEST_MODEL_UNSPECIFIED": 0, + "REQUEST_MODEL_VIRTUAL_HOSTED_STYLE": 1, + "REQUEST_MODEL_PATH_STYLE": 2 + } + }, + "NetworkProtocol": { + "values": { + "NETWORK_PROTOCOL_UNSPECIFIED": 0, + "NETWORK_PROTOCOL_HTTPS": 1, + "NETWORK_PROTOCOL_HTTP": 2 + } + }, + "ListApi": { + "values": { + "LIST_API_UNSPECIFIED": 0, + "LIST_OBJECTS_V2": 1, + "LIST_OBJECTS": 2 + } + } + } + }, "AgentPool": { "options": { "(google.api.resource).type": "storagetransfer.googleapis.com/agentPools", @@ -742,7 +861,8 @@ "awsS3DataSource", "httpDataSource", "posixDataSource", - "azureBlobStorageDataSource" + "azureBlobStorageDataSource", + "awsS3CompatibleDataSource" ] }, "intermediateDataLocation": { @@ -780,6 +900,10 @@ "type": "AzureBlobStorageData", "id": 8 }, + "awsS3CompatibleDataSource": { + "type": "AwsS3CompatibleData", + "id": 19 + }, "gcsIntermediateDataLocation": { "type": "GcsData", "id": 16 diff --git a/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json b/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json index 1c04cc0..162d0ae 100644 --- a/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json +++ b/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json @@ -359,6 +359,50 @@ } } }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async", + "title": "StorageTransferService deleteTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Deletes a transfer job. Deleting a transfer job sets its status to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED].", + "canonical": true, + "file": "storage_transfer_service.delete_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", + "async": true, + "parameters": [ + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "DeleteTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, { "regionTag": "storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async", "title": "StorageTransferService createAgentPool Sample", diff --git a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.js b/samples/generated/v1/storage_transfer_service.delete_transfer_job.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.js rename to samples/generated/v1/storage_transfer_service.delete_transfer_job.js diff --git a/samples/generated/v1/storage_transfer_service.update_transfer_job.js b/samples/generated/v1/storage_transfer_service.update_transfer_job.js index 2ae0d93..7961e98 100644 --- a/samples/generated/v1/storage_transfer_service.update_transfer_job.js +++ b/samples/generated/v1/storage_transfer_service.update_transfer_job.js @@ -47,7 +47,7 @@ function main(jobName, projectId, transferJob) { * other fields are rejected with the error * INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. Updating a job status * to DELETED google.storagetransfer.v1.TransferJob.Status.DELETED requires - * `storagetransfer.jobs.delete` permissions. + * `storagetransfer.jobs.delete` permission. */ // const transferJob = {} /** diff --git a/src/v1/gapic_metadata.json b/src/v1/gapic_metadata.json index 7f8bdf9..4155aeb 100644 --- a/src/v1/gapic_metadata.json +++ b/src/v1/gapic_metadata.json @@ -40,6 +40,11 @@ "resumeTransferOperation" ] }, + "DeleteTransferJob": { + "methods": [ + "deleteTransferJob" + ] + }, "CreateAgentPool": { "methods": [ "createAgentPool" @@ -114,6 +119,11 @@ "resumeTransferOperation" ] }, + "DeleteTransferJob": { + "methods": [ + "deleteTransferJob" + ] + }, "CreateAgentPool": { "methods": [ "createAgentPool" diff --git a/src/v1/storage_transfer_service_client.ts b/src/v1/storage_transfer_service_client.ts index a80302b..f76cf06 100644 --- a/src/v1/storage_transfer_service_client.ts +++ b/src/v1/storage_transfer_service_client.ts @@ -305,6 +305,7 @@ export class StorageTransferServiceClient { 'pauseTransferOperation', 'resumeTransferOperation', 'runTransferJob', + 'deleteTransferJob', 'createAgentPool', 'updateAgentPool', 'getAgentPool', @@ -619,7 +620,7 @@ export class StorageTransferServiceClient { * other fields are rejected with the error * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. Updating a job status * to {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED} requires - * `storagetransfer.jobs.delete` permissions. + * `storagetransfer.jobs.delete` permission. * @param {google.protobuf.FieldMask} request.updateTransferJobFieldMask * The field mask of the fields in `transferJob` that are to be updated in * this request. Fields in `transferJob` that can be updated are: @@ -1011,6 +1012,101 @@ export class StorageTransferServiceClient { callback ); } + /** + * Deletes a transfer job. Deleting a transfer job sets its status to + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.jobName + * Required. The job to delete. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the + * job. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/storage_transfer_service.delete_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async + */ + deleteTransferJob( + request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest | undefined, + {} | undefined + ] + >; + deleteTransferJob( + request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.storagetransfer.v1.IDeleteTransferJobRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteTransferJob( + request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.storagetransfer.v1.IDeleteTransferJobRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteTransferJob( + request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.storagetransfer.v1.IDeleteTransferJobRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.storagetransfer.v1.IDeleteTransferJobRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + job_name: request.jobName || '', + }); + this.initialize(); + return this.innerApiCalls.deleteTransferJob(request, options, callback); + } /** * Creates an agent pool resource. * @@ -1974,6 +2070,183 @@ export class StorageTransferServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- diff --git a/src/v1/storage_transfer_service_client_config.json b/src/v1/storage_transfer_service_client_config.json index 6e42410..93b4537 100644 --- a/src/v1/storage_transfer_service_client_config.json +++ b/src/v1/storage_transfer_service_client_config.json @@ -6,6 +6,9 @@ "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" ] }, "retry_params": { @@ -17,73 +20,87 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "264268458a9e88347dbacbd9398202ff5885a40b": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 2, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "GetGoogleServiceAccount": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "CreateTransferJob": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "UpdateTransferJob": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "GetTransferJob": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "ListTransferJobs": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "PauseTransferOperation": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "ResumeTransferOperation": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "RunTransferJob": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "CreateAgentPool": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "UpdateAgentPool": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "GetAgentPool": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "ListAgentPools": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" }, "DeleteAgentPool": { - "timeout_millis": 30000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" } } } diff --git a/test/gapic_storage_transfer_service_v1.ts b/test/gapic_storage_transfer_service_v1.ts index 433e373..e0641c1 100644 --- a/test/gapic_storage_transfer_service_v1.ts +++ b/test/gapic_storage_transfer_service_v1.ts @@ -1030,6 +1030,136 @@ describe('v1.StorageTransferServiceClient', () => { }); }); + describe('deleteTransferJob', () => { + it('invokes deleteTransferJob without error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteTransferJobRequest() + ); + request.jobName = ''; + const expectedHeaderRequestParams = 'job_name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTransferJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTransferJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteTransferJob without error using callback', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteTransferJobRequest() + ); + request.jobName = ''; + const expectedHeaderRequestParams = 'job_name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTransferJob = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTransferJob( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteTransferJob with error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteTransferJobRequest() + ); + request.jobName = ''; + const expectedHeaderRequestParams = 'job_name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTransferJob = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteTransferJob(request), expectedError); + assert( + (client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteTransferJob with closed client', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteTransferJobRequest() + ); + request.jobName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteTransferJob(request), expectedError); + }); + }); + describe('createAgentPool', () => { it('invokes createAgentPool without error', async () => { const client = @@ -2297,6 +2427,322 @@ describe('v1.StorageTransferServiceClient', () => { ); }); }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('agentPools', () => { From 2231ec7feadd3d82647569930dbd85b2d154caad Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 14 Sep 2022 20:23:56 +0000 Subject: [PATCH 3/4] chore: use gapic-generator-typescript v2.17.0 PiperOrigin-RevId: 474338479 Source-Link: https://github.com/googleapis/googleapis/commit/d5d35e0353b59719e8917103b1bc7df2782bf6ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/efcd3f93962a103f68f003e2a1eecde6fa216a27 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWZjZDNmOTM5NjJhMTAzZjY4ZjAwM2UyYTFlZWNkZTZmYTIxNmEyNyJ9 --- 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 + .../google/storagetransfer/v1/transfer.proto | 387 +++ .../storagetransfer/v1/transfer_types.proto | 1227 +++++++++ ...et_metadata.google.storagetransfer.v1.json | 631 +++++ ...rage_transfer_service.create_agent_pool.js | 81 + ...ge_transfer_service.create_transfer_job.js | 61 + ...rage_transfer_service.delete_agent_pool.js | 61 + ...ge_transfer_service.delete_transfer_job.js | 67 + ...storage_transfer_service.get_agent_pool.js | 61 + ...sfer_service.get_google_service_account.js | 62 + ...orage_transfer_service.get_transfer_job.js | 67 + ...orage_transfer_service.list_agent_pools.js | 80 + ...age_transfer_service.list_transfer_jobs.js | 81 + ...ansfer_service.pause_transfer_operation.js | 61 + ...nsfer_service.resume_transfer_operation.js | 61 + ...orage_transfer_service.run_transfer_job.js | 68 + ...rage_transfer_service.update_agent_pool.js | 76 + ...ge_transfer_service.update_transfer_job.js | 94 + owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 171 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../src/v1/storage_transfer_service_client.ts | 1916 ++++++++++++++ ...torage_transfer_service_client_config.json | 108 + .../storage_transfer_service_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../test/gapic_storage_transfer_service_v1.ts | 2242 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + 38 files changed, 8117 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/storagetransfer/v1/transfer.proto create mode 100644 owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/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..0ffbf58 --- /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/storage-transfer', + 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..dc9f51c --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Storagetransfer: 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..aa30966 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/storage-transfer", + "version": "0.1.0", + "description": "Storagetransfer client for Node.js", + "repository": "googleapis/nodejs-storagetransfer", + "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 storagetransfer", + "storagetransfer", + "storage transfer service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "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.5.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.59", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto new file mode 100644 index 0000000..802cc10 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto @@ -0,0 +1,387 @@ +// 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 +// +// 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.storagetransfer.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/storagetransfer/v1/transfer_types.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; +option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; +option java_outer_classname = "TransferProto"; +option java_package = "com.google.storagetransfer.v1.proto"; +option php_namespace = "Google\\Cloud\\StorageTransfer\\V1"; +option ruby_package = "Google::Cloud::StorageTransfer::V1"; + +// Storage Transfer Service and its protos. +// Transfers data between between Google Cloud Storage buckets or from a data +// source external to Google to a Cloud Storage bucket. +service StorageTransferService { + option (google.api.default_host) = "storagetransfer.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns the Google service account that is used by Storage Transfer + // Service to access buckets in the project where transfers + // run or in other projects. Each Google service account is associated + // with one Google Cloud project. Users + // should add this service account to the Google Cloud Storage bucket + // ACLs to grant access to Storage Transfer Service. This service + // account is created and owned by Storage Transfer Service and can + // only be used by Storage Transfer Service. + rpc GetGoogleServiceAccount(GetGoogleServiceAccountRequest) returns (GoogleServiceAccount) { + option (google.api.http) = { + get: "/v1/googleServiceAccounts/{project_id}" + }; + } + + // Creates a transfer job that runs periodically. + rpc CreateTransferJob(CreateTransferJobRequest) returns (TransferJob) { + option (google.api.http) = { + post: "/v1/transferJobs" + body: "transfer_job" + }; + } + + // Updates a transfer job. Updating a job's transfer spec does not affect + // transfer operations that are running already. + // + // **Note:** The job's [status][google.storagetransfer.v1.TransferJob.status] field can be modified + // using this RPC (for example, to set a job's status to + // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED], + // [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], or + // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]). + rpc UpdateTransferJob(UpdateTransferJobRequest) returns (TransferJob) { + option (google.api.http) = { + patch: "/v1/{job_name=transferJobs/**}" + body: "*" + }; + } + + // Gets a transfer job. + rpc GetTransferJob(GetTransferJobRequest) returns (TransferJob) { + option (google.api.http) = { + get: "/v1/{job_name=transferJobs/**}" + }; + } + + // Lists transfer jobs. + rpc ListTransferJobs(ListTransferJobsRequest) returns (ListTransferJobsResponse) { + option (google.api.http) = { + get: "/v1/transferJobs" + }; + } + + // Pauses a transfer operation. + rpc PauseTransferOperation(PauseTransferOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=transferOperations/**}:pause" + body: "*" + }; + } + + // Resumes a transfer operation that is paused. + rpc ResumeTransferOperation(ResumeTransferOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=transferOperations/**}:resume" + body: "*" + }; + } + + // Attempts to start a new TransferOperation for the current TransferJob. A + // TransferJob has a maximum of one active TransferOperation. If this method + // is called while a TransferOperation is active, an error will be returned. + rpc RunTransferJob(RunTransferJobRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{job_name=transferJobs/**}:run" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "TransferOperation" + }; + } + + // Deletes a transfer job. Deleting a transfer job sets its status to + // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. + rpc DeleteTransferJob(DeleteTransferJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{job_name=transferJobs/**}" + }; + } + + // Creates an agent pool resource. + rpc CreateAgentPool(CreateAgentPoolRequest) returns (AgentPool) { + option (google.api.http) = { + post: "/v1/projects/{project_id=*}/agentPools" + body: "agent_pool" + }; + option (google.api.method_signature) = "project_id,agent_pool,agent_pool_id"; + } + + // Updates an existing agent pool resource. + rpc UpdateAgentPool(UpdateAgentPoolRequest) returns (AgentPool) { + option (google.api.http) = { + patch: "/v1/{agent_pool.name=projects/*/agentPools/*}" + body: "agent_pool" + }; + option (google.api.method_signature) = "agent_pool,update_mask"; + } + + // Gets an agent pool. + rpc GetAgentPool(GetAgentPoolRequest) returns (AgentPool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/agentPools/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists agent pools. + rpc ListAgentPools(ListAgentPoolsRequest) returns (ListAgentPoolsResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id=*}/agentPools" + }; + option (google.api.method_signature) = "project_id"; + } + + // Deletes an agent pool. + rpc DeleteAgentPool(DeleteAgentPoolRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/agentPools/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request passed to GetGoogleServiceAccount. +message GetGoogleServiceAccountRequest { + // Required. The ID of the Google Cloud project that the Google service + // account is associated with. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to CreateTransferJob. +message CreateTransferJobRequest { + // Required. The job to create. + TransferJob transfer_job = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to UpdateTransferJob. +message UpdateTransferJobRequest { + // Required. The name of job to update. + string job_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the Google Cloud project that owns the + // job. + string project_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The job to update. `transferJob` is expected to specify one or more of + // five fields: [description][google.storagetransfer.v1.TransferJob.description], + // [transfer_spec][google.storagetransfer.v1.TransferJob.transfer_spec], + // [notification_config][google.storagetransfer.v1.TransferJob.notification_config], + // [logging_config][google.storagetransfer.v1.TransferJob.logging_config], and + // [status][google.storagetransfer.v1.TransferJob.status]. An `UpdateTransferJobRequest` that specifies + // other fields are rejected with the error + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. Updating a job status + // to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED] requires + // `storagetransfer.jobs.delete` permission. + TransferJob transfer_job = 3 [(google.api.field_behavior) = REQUIRED]; + + // The field mask of the fields in `transferJob` that are to be updated in + // this request. Fields in `transferJob` that can be updated are: + // [description][google.storagetransfer.v1.TransferJob.description], + // [transfer_spec][google.storagetransfer.v1.TransferJob.transfer_spec], + // [notification_config][google.storagetransfer.v1.TransferJob.notification_config], + // [logging_config][google.storagetransfer.v1.TransferJob.logging_config], and + // [status][google.storagetransfer.v1.TransferJob.status]. To update the `transfer_spec` of the job, a + // complete transfer specification must be provided. An incomplete + // specification missing any required fields is rejected with the error + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + google.protobuf.FieldMask update_transfer_job_field_mask = 4; +} + +// Request passed to GetTransferJob. +message GetTransferJobRequest { + // Required. The job to get. + string job_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the Google Cloud project that owns the + // job. + string project_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to DeleteTransferJob. +message DeleteTransferJobRequest { + // Required. The job to delete. + string job_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the Google Cloud project that owns the + // job. + string project_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// `projectId`, `jobNames`, and `jobStatuses` are query parameters that can +// be specified when listing transfer jobs. +message ListTransferJobsRequest { + // Required. A list of query parameters specified as JSON text in the form of: + // `{"projectId":"my_project_id", + // "jobNames":["jobid1","jobid2",...], + // "jobStatuses":["status1","status2",...]}` + // + // Since `jobNames` and `jobStatuses` support multiple values, their values + // must be specified with array notation. `projectId` is required. + // `jobNames` and `jobStatuses` are optional. The valid values for + // `jobStatuses` are case-insensitive: + // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED], + // [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], and + // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. + string filter = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list page size. The max allowed value is 256. + int32 page_size = 4; + + // The list page token. + string page_token = 5; +} + +// Response from ListTransferJobs. +message ListTransferJobsResponse { + // A list of transfer jobs. + repeated TransferJob transfer_jobs = 1; + + // The list next page token. + string next_page_token = 2; +} + +// Request passed to PauseTransferOperation. +message PauseTransferOperationRequest { + // Required. The name of the transfer operation. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to ResumeTransferOperation. +message ResumeTransferOperationRequest { + // Required. The name of the transfer operation. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request passed to RunTransferJob. +message RunTransferJobRequest { + // Required. The name of the transfer job. + string job_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the Google Cloud project that owns the transfer + // job. + string project_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies the request passed to CreateAgentPool. +message CreateAgentPoolRequest { + // Required. The ID of the Google Cloud project that owns the + // agent pool. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The agent pool to create. + AgentPool agent_pool = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the agent pool to create. + // + // The `agent_pool_id` must meet the following requirements: + // + // * Length of 128 characters or less. + // * Not start with the string `goog`. + // * Start with a lowercase ASCII character, followed by: + // * Zero or more: lowercase Latin alphabet characters, numerals, + // hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). + // * One or more numerals or lowercase ASCII characters. + // + // As expressed by the regular expression: + // `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`. + string agent_pool_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies the request passed to UpdateAgentPool. +message UpdateAgentPoolRequest { + // Required. The agent pool to update. `agent_pool` is expected to specify following + // fields: + // + // * [name][google.storagetransfer.v1.AgentPool.name] + // + // * [display_name][google.storagetransfer.v1.AgentPool.display_name] + // + // * [bandwidth_limit][google.storagetransfer.v1.AgentPool.bandwidth_limit] + // An `UpdateAgentPoolRequest` with any other fields is rejected + // with the error [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + AgentPool agent_pool = 1 [(google.api.field_behavior) = REQUIRED]; + + // The [field mask] + // (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) + // of the fields in `agentPool` to update in this request. + // The following `agentPool` fields can be updated: + // + // * [display_name][google.storagetransfer.v1.AgentPool.display_name] + // + // * [bandwidth_limit][google.storagetransfer.v1.AgentPool.bandwidth_limit] + google.protobuf.FieldMask update_mask = 2; +} + +// Specifies the request passed to GetAgentPool. +message GetAgentPoolRequest { + // Required. The name of the agent pool to get. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies the request passed to DeleteAgentPool. +message DeleteAgentPoolRequest { + // Required. The name of the agent pool to delete. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request passed to ListAgentPools. +message ListAgentPoolsRequest { + // Required. The ID of the Google Cloud project that owns the job. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // An optional list of query parameters specified as JSON text in the + // form of: + // + // `{"agentPoolNames":["agentpool1","agentpool2",...]}` + // + // Since `agentPoolNames` support multiple values, its values must be + // specified with array notation. When the filter is either empty or not + // provided, the list returns all agent pools for the project. + string filter = 2; + + // The list page size. The max allowed value is `256`. + int32 page_size = 3; + + // The list page token. + string page_token = 4; +} + +// Response from ListAgentPools. +message ListAgentPoolsResponse { + // A list of agent pools. + repeated AgentPool agent_pools = 1; + + // The list next page token. + string next_page_token = 2; +} diff --git a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto new file mode 100644 index 0000000..4e1a3b5 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto @@ -0,0 +1,1227 @@ +// 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 +// +// 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.storagetransfer.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/code.proto"; +import "google/type/date.proto"; +import "google/type/timeofday.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; +option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; +option java_outer_classname = "TransferTypes"; +option java_package = "com.google.storagetransfer.v1.proto"; +option php_namespace = "Google\\Cloud\\StorageTransfer\\V1"; +option ruby_package = "Google::Cloud::StorageTransfer::V1"; + +// Google service account +message GoogleServiceAccount { + // Email address of the service account. + string account_email = 1; + + // Unique identifier for the service account. + string subject_id = 2; +} + +// AWS access key (see +// [AWS Security +// Credentials](https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)). +// +// For information on our data retention policy for user credentials, see +// [User credentials](/storage-transfer/docs/data-retention#user-credentials). +message AwsAccessKey { + // Required. AWS access key ID. + string access_key_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. AWS secret access key. This field is not returned in RPC + // responses. + string secret_access_key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Azure credentials +// +// For information on our data retention policy for user credentials, see +// [User credentials](/storage-transfer/docs/data-retention#user-credentials). +message AzureCredentials { + // Required. Azure shared access signature (SAS). + // + // For more information about SAS, see + // [Grant limited access to Azure Storage resources using shared access + // signatures + // (SAS)](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview). + string sas_token = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Conditions that determine which objects are transferred. Applies only +// to Cloud Data Sources such as S3, Azure, and Cloud Storage. +// +// The "last modification time" refers to the time of the +// last change to the object's content or metadata — specifically, this is +// the `updated` property of Cloud Storage objects, the `LastModified` field +// of S3 objects, and the `Last-Modified` header of Azure blobs. +// +// Transfers with a [PosixFilesystem][google.storagetransfer.v1.PosixFilesystem] source or destination don't support +// `ObjectConditions`. +message ObjectConditions { + // Ensures that objects are not transferred until a specific minimum time + // has elapsed after the "last modification time". When a + // [TransferOperation][google.storagetransfer.v1.TransferOperation] begins, objects with a "last modification time" are + // transferred only if the elapsed time between the + // [start_time][google.storagetransfer.v1.TransferOperation.start_time] of the `TransferOperation` + // and the "last modification time" of the object is equal to or + // greater than the value of min_time_elapsed_since_last_modification`. + // Objects that do not have a "last modification time" are also transferred. + google.protobuf.Duration min_time_elapsed_since_last_modification = 1; + + // Ensures that objects are not transferred if a specific maximum time + // has elapsed since the "last modification time". + // When a [TransferOperation][google.storagetransfer.v1.TransferOperation] begins, objects with a + // "last modification time" are transferred only if the elapsed time + // between the [start_time][google.storagetransfer.v1.TransferOperation.start_time] of the + // `TransferOperation`and the "last modification time" of the object + // is less than the value of max_time_elapsed_since_last_modification`. + // Objects that do not have a "last modification time" are also transferred. + google.protobuf.Duration max_time_elapsed_since_last_modification = 2; + + // If you specify `include_prefixes`, Storage Transfer Service uses the items + // in the `include_prefixes` array to determine which objects to include in a + // transfer. Objects must start with one of the matching `include_prefixes` + // for inclusion in the transfer. If [exclude_prefixes][google.storagetransfer.v1.ObjectConditions.exclude_prefixes] is specified, + // objects must not start with any of the `exclude_prefixes` specified for + // inclusion in the transfer. + // + // The following are requirements of `include_prefixes`: + // + // * Each include-prefix can contain any sequence of Unicode characters, to + // a max length of 1024 bytes when UTF8-encoded, and must not contain + // Carriage Return or Line Feed characters. Wildcard matching and regular + // expression matching are not supported. + // + // * Each include-prefix must omit the leading slash. For example, to + // include the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, + // specify the include-prefix as `logs/y=2015/requests.gz`. + // + // * None of the include-prefix values can be empty, if specified. + // + // * Each include-prefix must include a distinct portion of the object + // namespace. No include-prefix may be a prefix of another + // include-prefix. + // + // The max size of `include_prefixes` is 1000. + // + // For more information, see [Filtering objects from + // transfers](/storage-transfer/docs/filtering-objects-from-transfers). + repeated string include_prefixes = 3; + + // If you specify `exclude_prefixes`, Storage Transfer Service uses the items + // in the `exclude_prefixes` array to determine which objects to exclude from + // a transfer. Objects must not start with one of the matching + // `exclude_prefixes` for inclusion in a transfer. + // + // The following are requirements of `exclude_prefixes`: + // + // * Each exclude-prefix can contain any sequence of Unicode characters, to + // a max length of 1024 bytes when UTF8-encoded, and must not contain + // Carriage Return or Line Feed characters. Wildcard matching and regular + // expression matching are not supported. + // + // * Each exclude-prefix must omit the leading slash. For example, to + // exclude the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, + // specify the exclude-prefix as `logs/y=2015/requests.gz`. + // + // * None of the exclude-prefix values can be empty, if specified. + // + // * Each exclude-prefix must exclude a distinct portion of the object + // namespace. No exclude-prefix may be a prefix of another + // exclude-prefix. + // + // * If [include_prefixes][google.storagetransfer.v1.ObjectConditions.include_prefixes] is specified, then each exclude-prefix must + // start with the value of a path explicitly included by `include_prefixes`. + // + // The max size of `exclude_prefixes` is 1000. + // + // For more information, see [Filtering objects from + // transfers](/storage-transfer/docs/filtering-objects-from-transfers). + repeated string exclude_prefixes = 4; + + // If specified, only objects with a "last modification time" on or after + // this timestamp and objects that don't have a "last modification time" are + // transferred. + // + // The `last_modified_since` and `last_modified_before` fields can be used + // together for chunked data processing. For example, consider a script that + // processes each day's worth of data at a time. For that you'd set each + // of the fields as follows: + // + // * `last_modified_since` to the start of the day + // + // * `last_modified_before` to the end of the day + google.protobuf.Timestamp last_modified_since = 5; + + // If specified, only objects with a "last modification time" before this + // timestamp and objects that don't have a "last modification time" are + // transferred. + google.protobuf.Timestamp last_modified_before = 6; +} + +// In a GcsData resource, an object's name is the Cloud Storage object's +// name and its "last modification time" refers to the object's `updated` +// property of Cloud Storage objects, which changes when the content or the +// metadata of the object is updated. +message GcsData { + // Required. Cloud Storage bucket name. Must meet + // [Bucket Name Requirements](/storage/docs/naming#requirements). + string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Root path to transfer objects. + // + // Must be an empty string or full path name that ends with a '/'. This field + // is treated as an object prefix. As such, it should generally not begin with + // a '/'. + // + // The root path value must meet + // [Object Name Requirements](/storage/docs/naming#objectnames). + string path = 3; +} + +// An AwsS3Data resource can be a data source, but not a data sink. +// In an AwsS3Data resource, an object's name is the S3 object's key name. +message AwsS3Data { + // Required. S3 Bucket name (see + // [Creating a + // bucket](https://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-get-location-example.html)). + string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Input only. AWS access key used to sign the API requests to the AWS S3 bucket. + // Permissions on the bucket must be granted to the access ID of the AWS + // access key. + // + // For information on our data retention policy for user credentials, see + // [User credentials](/storage-transfer/docs/data-retention#user-credentials). + AwsAccessKey aws_access_key = 2 [(google.api.field_behavior) = INPUT_ONLY]; + + // Root path to transfer objects. + // + // Must be an empty string or full path name that ends with a '/'. This field + // is treated as an object prefix. As such, it should generally not begin with + // a '/'. + string path = 3; + + // The Amazon Resource Name (ARN) of the role to support temporary + // credentials via `AssumeRoleWithWebIdentity`. For more information about + // ARNs, see [IAM + // ARNs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns). + // + // When a role ARN is provided, Transfer Service fetches temporary + // credentials for the session using a `AssumeRoleWithWebIdentity` call for + // the provided role using the [GoogleServiceAccount][google.storagetransfer.v1.GoogleServiceAccount] for this project. + string role_arn = 4; +} + +// An AzureBlobStorageData resource can be a data source, but not a data sink. +// An AzureBlobStorageData resource represents one Azure container. The storage +// account determines the [Azure +// endpoint](https://docs.microsoft.com/en-us/azure/storage/common/storage-create-storage-account#storage-account-endpoints). +// In an AzureBlobStorageData resource, a blobs's name is the [Azure Blob +// Storage blob's key +// name](https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#blob-names). +message AzureBlobStorageData { + // Required. The name of the Azure Storage account. + string storage_account = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. Credentials used to authenticate API requests to Azure. + // + // For information on our data retention policy for user credentials, see + // [User credentials](/storage-transfer/docs/data-retention#user-credentials). + AzureCredentials azure_credentials = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // Required. The container to transfer from the Azure Storage account. + string container = 4 [(google.api.field_behavior) = REQUIRED]; + + // Root path to transfer objects. + // + // Must be an empty string or full path name that ends with a '/'. This field + // is treated as an object prefix. As such, it should generally not begin with + // a '/'. + string path = 5; +} + +// An HttpData resource specifies a list of objects on the web to be transferred +// over HTTP. The information of the objects to be transferred is contained in +// a file referenced by a URL. The first line in the file must be +// `"TsvHttpData-1.0"`, which specifies the format of the file. Subsequent +// lines specify the information of the list of objects, one object per list +// entry. Each entry has the following tab-delimited fields: +// +// * **HTTP URL** — The location of the object. +// +// * **Length** — The size of the object in bytes. +// +// * **MD5** — The base64-encoded MD5 hash of the object. +// +// For an example of a valid TSV file, see +// [Transferring data from +// URLs](https://cloud.google.com/storage-transfer/docs/create-url-list). +// +// When transferring data based on a URL list, keep the following in mind: +// +// * When an object located at `http(s)://hostname:port/` is +// transferred to a data sink, the name of the object at the data sink is +// `/`. +// +// * If the specified size of an object does not match the actual size of the +// object fetched, the object is not transferred. +// +// * If the specified MD5 does not match the MD5 computed from the transferred +// bytes, the object transfer fails. +// +// * Ensure that each URL you specify is publicly accessible. For +// example, in Cloud Storage you can +// [share an object publicly] +// (/storage/docs/cloud-console#_sharingdata) and get a link to it. +// +// * Storage Transfer Service obeys `robots.txt` rules and requires the source +// HTTP server to support `Range` requests and to return a `Content-Length` +// header in each response. +// +// * [ObjectConditions][google.storagetransfer.v1.ObjectConditions] have no effect when filtering objects to transfer. +message HttpData { + // Required. The URL that points to the file that stores the object list + // entries. This file must allow public access. Currently, only URLs with + // HTTP and HTTPS schemes are supported. + string list_url = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A POSIX filesystem resource. +message PosixFilesystem { + // Root directory path to the filesystem. + string root_directory = 1; +} + +// An AwsS3CompatibleData resource. +message AwsS3CompatibleData { + // Required. Specifies the name of the bucket. + string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the root path to transfer objects. + // + // Must be an empty string or full path name that ends with a '/'. This + // field is treated as an object prefix. As such, it should generally not + // begin with a '/'. + string path = 2; + + // Required. Specifies the endpoint of the storage service. + string endpoint = 3 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the region to sign requests with. This can be left blank if + // requests should be signed with an empty region. + string region = 5; + + // Specifies the metadata of the S3 compatible data provider. Each provider + // may contain some attributes that do not apply to all S3-compatible data + // providers. When not specified, S3CompatibleMetadata is used by default. + oneof data_provider { + // A S3 compatible metadata. + S3CompatibleMetadata s3_metadata = 4; + } +} + +// S3CompatibleMetadata contains the metadata fields that apply to the basic +// types of S3-compatible data providers. +message S3CompatibleMetadata { + // The authentication and authorization method used by the storage service. + enum AuthMethod { + // AuthMethod is not specified. + AUTH_METHOD_UNSPECIFIED = 0; + + // Auth requests with AWS SigV4. + AUTH_METHOD_AWS_SIGNATURE_V4 = 1; + + // Auth requests with AWS SigV2. + AUTH_METHOD_AWS_SIGNATURE_V2 = 2; + } + + // The request model of the API. + enum RequestModel { + // RequestModel is not specified. + REQUEST_MODEL_UNSPECIFIED = 0; + + // Perform requests using Virtual Hosted Style. + // Example: https://bucket-name.s3.region.amazonaws.com/key-name + REQUEST_MODEL_VIRTUAL_HOSTED_STYLE = 1; + + // Perform requests using Path Style. + // Example: https://s3.region.amazonaws.com/bucket-name/key-name + REQUEST_MODEL_PATH_STYLE = 2; + } + + // The agent network protocol to access the storage service. + enum NetworkProtocol { + // NetworkProtocol is not specified. + NETWORK_PROTOCOL_UNSPECIFIED = 0; + + // Perform requests using HTTPS. + NETWORK_PROTOCOL_HTTPS = 1; + + // Not recommended: This sends data in clear-text. This is only + // appropriate within a closed network or for publicly available data. + // Perform requests using HTTP. + NETWORK_PROTOCOL_HTTP = 2; + } + + // The Listing API to use for discovering objects. + enum ListApi { + // ListApi is not specified. + LIST_API_UNSPECIFIED = 0; + + // Perform listing using ListObjectsV2 API. + LIST_OBJECTS_V2 = 1; + + // Legacy ListObjects API. + LIST_OBJECTS = 2; + } + + // Specifies the authentication and authorization method used by the storage + // service. When not specified, Transfer Service will attempt to determine + // right auth method to use. + AuthMethod auth_method = 1; + + // Specifies the API request model used to call the storage service. When not + // specified, the default value of RequestModel + // REQUEST_MODEL_VIRTUAL_HOSTED_STYLE is used. + RequestModel request_model = 2; + + // Specifies the network protocol of the agent. When not specified, the + // default value of NetworkProtocol NETWORK_PROTOCOL_HTTPS is used. + NetworkProtocol protocol = 3; + + // The Listing API to use for discovering objects. When not specified, + // Transfer Service will attempt to determine the right API to use. + ListApi list_api = 4; +} + +// Represents an On-Premises Agent pool. +message AgentPool { + option (google.api.resource) = { + type: "storagetransfer.googleapis.com/agentPools" + pattern: "projects/{project_id}/agentPools/{agent_pool_id}" + }; + + // The state of an AgentPool. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // This is an initialization state. During this stage, the resources such as + // Pub/Sub topics are allocated for the AgentPool. + CREATING = 1; + + // Determines that the AgentPool is created for use. At this state, Agents + // can join the AgentPool and participate in the transfer jobs in that pool. + CREATED = 2; + + // Determines that the AgentPool deletion has been initiated, and all the + // resources are scheduled to be cleaned up and freed. + DELETING = 3; + } + + // Specifies a bandwidth limit for an agent pool. + message BandwidthLimit { + // Bandwidth rate in megabytes per second, distributed across all the agents + // in the pool. + int64 limit_mbps = 1; + } + + // Required. Specifies a unique string that identifies the agent pool. + // + // Format: `projects/{project_id}/agentPools/{agent_pool_id}` + string name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the client-specified AgentPool description. + string display_name = 3; + + // Output only. Specifies the state of the AgentPool. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Specifies the bandwidth limit details. If this field is unspecified, the + // default value is set as 'No Limit'. + BandwidthLimit bandwidth_limit = 5; +} + +// TransferOptions define the actions to be performed on objects in a transfer. +message TransferOptions { + // Specifies when to overwrite an object in the sink when an object with + // matching name is found in the source. + enum OverwriteWhen { + // Overwrite behavior is unspecified. + OVERWRITE_WHEN_UNSPECIFIED = 0; + + // Overwrites destination objects with the source objects, only if the + // objects have the same name but different HTTP ETags or checksum values. + DIFFERENT = 1; + + // Never overwrites a destination object if a source object has the + // same name. In this case, the source object is not transferred. + NEVER = 2; + + // Always overwrite the destination object with the source object, even if + // the HTTP Etags or checksum values are the same. + ALWAYS = 3; + } + + // When to overwrite objects that already exist in the sink. The default is + // that only objects that are different from the source are ovewritten. If + // true, all objects in the sink whose name matches an object in the source + // are overwritten with the source object. + bool overwrite_objects_already_existing_in_sink = 1; + + // Whether objects that exist only in the sink should be deleted. + // + // **Note:** This option and [delete_objects_from_source_after_transfer][google.storagetransfer.v1.TransferOptions.delete_objects_from_source_after_transfer] are + // mutually exclusive. + bool delete_objects_unique_in_sink = 2; + + // Whether objects should be deleted from the source after they are + // transferred to the sink. + // + // **Note:** This option and [delete_objects_unique_in_sink][google.storagetransfer.v1.TransferOptions.delete_objects_unique_in_sink] are mutually + // exclusive. + bool delete_objects_from_source_after_transfer = 3; + + // When to overwrite objects that already exist in the sink. If not set, + // overwrite behavior is determined by + // [overwrite_objects_already_existing_in_sink][google.storagetransfer.v1.TransferOptions.overwrite_objects_already_existing_in_sink]. + OverwriteWhen overwrite_when = 4; + + // Represents the selected metadata options for a transfer job. + MetadataOptions metadata_options = 5; +} + +// Configuration for running a transfer. +message TransferSpec { + // The write sink for the data. + oneof data_sink { + // A Cloud Storage data sink. + GcsData gcs_data_sink = 4; + + // A POSIX Filesystem data sink. + PosixFilesystem posix_data_sink = 13; + } + + // The read source of the data. + oneof data_source { + // A Cloud Storage data source. + GcsData gcs_data_source = 1; + + // An AWS S3 data source. + AwsS3Data aws_s3_data_source = 2; + + // An HTTP URL data source. + HttpData http_data_source = 3; + + // A POSIX Filesystem data source. + PosixFilesystem posix_data_source = 14; + + // An Azure Blob Storage data source. + AzureBlobStorageData azure_blob_storage_data_source = 8; + + // An AWS S3 compatible data source. + AwsS3CompatibleData aws_s3_compatible_data_source = 19; + } + + // Represents a supported data container type which is required for transfer + // jobs which needs a data source, a data sink and an intermediate location to + // transfer data through. This is validated on TransferJob creation. + oneof intermediate_data_location { + // Cloud Storage intermediate data location. + GcsData gcs_intermediate_data_location = 16; + } + + // Only objects that satisfy these object conditions are included in the set + // of data source and data sink objects. Object conditions based on + // objects' "last modification time" do not exclude objects in a data sink. + ObjectConditions object_conditions = 5; + + // If the option + // [delete_objects_unique_in_sink][google.storagetransfer.v1.TransferOptions.delete_objects_unique_in_sink] + // is `true` and time-based object conditions such as 'last modification time' + // are specified, the request fails with an + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. + TransferOptions transfer_options = 6; + + // A manifest file provides a list of objects to be transferred from the data + // source. This field points to the location of the manifest file. + // Otherwise, the entire source bucket is used. ObjectConditions still apply. + TransferManifest transfer_manifest = 15; + + // Specifies the agent pool name associated with the posix data source. When + // unspecified, the default name is used. + string source_agent_pool_name = 17; + + // Specifies the agent pool name associated with the posix data sink. When + // unspecified, the default name is used. + string sink_agent_pool_name = 18; +} + +// Specifies the metadata options for running a transfer. +message MetadataOptions { + // Whether symlinks should be skipped or preserved during a transfer job. + enum Symlink { + // Symlink behavior is unspecified. + SYMLINK_UNSPECIFIED = 0; + + // Do not preserve symlinks during a transfer job. + SYMLINK_SKIP = 1; + + // Preserve symlinks during a transfer job. + SYMLINK_PRESERVE = 2; + } + + // Options for handling file mode attribute. + enum Mode { + // Mode behavior is unspecified. + MODE_UNSPECIFIED = 0; + + // Do not preserve mode during a transfer job. + MODE_SKIP = 1; + + // Preserve mode during a transfer job. + MODE_PRESERVE = 2; + } + + // Options for handling file GID attribute. + enum GID { + // GID behavior is unspecified. + GID_UNSPECIFIED = 0; + + // Do not preserve GID during a transfer job. + GID_SKIP = 1; + + // Preserve GID during a transfer job. + GID_NUMBER = 2; + } + + // Options for handling file UID attribute. + enum UID { + // UID behavior is unspecified. + UID_UNSPECIFIED = 0; + + // Do not preserve UID during a transfer job. + UID_SKIP = 1; + + // Preserve UID during a transfer job. + UID_NUMBER = 2; + } + + // Options for handling Cloud Storage object ACLs. + enum Acl { + // ACL behavior is unspecified. + ACL_UNSPECIFIED = 0; + + // Use the destination bucket's default object ACLS, if applicable. + ACL_DESTINATION_BUCKET_DEFAULT = 1; + + // Preserve the object's original ACLs. This requires the service account + // to have `storage.objects.getIamPolicy` permission for the source object. + // [Uniform bucket-level + // access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) + // must not be enabled on either the source or destination buckets. + ACL_PRESERVE = 2; + } + + // Options for handling Google Cloud Storage object storage class. + enum StorageClass { + // Storage class behavior is unspecified. + STORAGE_CLASS_UNSPECIFIED = 0; + + // Use the destination bucket's default storage class. + STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT = 1; + + // Preserve the object's original storage class. This is only supported for + // transfers from Google Cloud Storage buckets. + STORAGE_CLASS_PRESERVE = 2; + + // Set the storage class to STANDARD. + STORAGE_CLASS_STANDARD = 3; + + // Set the storage class to NEARLINE. + STORAGE_CLASS_NEARLINE = 4; + + // Set the storage class to COLDLINE. + STORAGE_CLASS_COLDLINE = 5; + + // Set the storage class to ARCHIVE. + STORAGE_CLASS_ARCHIVE = 6; + } + + // Options for handling temporary holds for Google Cloud Storage objects. + enum TemporaryHold { + // Temporary hold behavior is unspecified. + TEMPORARY_HOLD_UNSPECIFIED = 0; + + // Do not set a temporary hold on the destination object. + TEMPORARY_HOLD_SKIP = 1; + + // Preserve the object's original temporary hold status. + TEMPORARY_HOLD_PRESERVE = 2; + } + + // Options for handling the KmsKey setting for Google Cloud Storage objects. + enum KmsKey { + // KmsKey behavior is unspecified. + KMS_KEY_UNSPECIFIED = 0; + + // Use the destination bucket's default encryption settings. + KMS_KEY_DESTINATION_BUCKET_DEFAULT = 1; + + // Preserve the object's original Cloud KMS customer-managed encryption key + // (CMEK) if present. Objects that do not use a Cloud KMS encryption key + // will be encrypted using the destination bucket's encryption settings. + KMS_KEY_PRESERVE = 2; + } + + // Options for handling `timeCreated` metadata for Google Cloud Storage + // objects. + enum TimeCreated { + // TimeCreated behavior is unspecified. + TIME_CREATED_UNSPECIFIED = 0; + + // Do not preserve the `timeCreated` metadata from the source object. + TIME_CREATED_SKIP = 1; + + // Preserves the source object's `timeCreated` metadata in the `customTime` + // field in the destination object. Note that any value stored in the + // source object's `customTime` field will not be propagated to the + // destination object. + TIME_CREATED_PRESERVE_AS_CUSTOM_TIME = 2; + } + + // Specifies how symlinks should be handled by the transfer. By default, + // symlinks are not preserved. Only applicable to transfers involving + // POSIX file systems, and ignored for other transfers. + Symlink symlink = 1; + + // Specifies how each file's mode attribute should be handled by the transfer. + // By default, mode is not preserved. Only applicable to transfers involving + // POSIX file systems, and ignored for other transfers. + Mode mode = 2; + + // Specifies how each file's POSIX group ID (GID) attribute should be handled + // by the transfer. By default, GID is not preserved. Only applicable to + // transfers involving POSIX file systems, and ignored for other transfers. + GID gid = 3; + + // Specifies how each file's POSIX user ID (UID) attribute should be handled + // by the transfer. By default, UID is not preserved. Only applicable to + // transfers involving POSIX file systems, and ignored for other transfers. + UID uid = 4; + + // Specifies how each object's ACLs should be preserved for transfers between + // Google Cloud Storage buckets. If unspecified, the default behavior is the + // same as ACL_DESTINATION_BUCKET_DEFAULT. + Acl acl = 5; + + // Specifies the storage class to set on objects being transferred to Google + // Cloud Storage buckets. If unspecified, the default behavior is the same as + // [STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT][google.storagetransfer.v1.MetadataOptions.StorageClass.STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT]. + StorageClass storage_class = 6; + + // Specifies how each object's temporary hold status should be preserved for + // transfers between Google Cloud Storage buckets. If unspecified, the + // default behavior is the same as + // [TEMPORARY_HOLD_PRESERVE][google.storagetransfer.v1.MetadataOptions.TemporaryHold.TEMPORARY_HOLD_PRESERVE]. + TemporaryHold temporary_hold = 7; + + // Specifies how each object's Cloud KMS customer-managed encryption key + // (CMEK) is preserved for transfers between Google Cloud Storage buckets. If + // unspecified, the default behavior is the same as + // [KMS_KEY_DESTINATION_BUCKET_DEFAULT][google.storagetransfer.v1.MetadataOptions.KmsKey.KMS_KEY_DESTINATION_BUCKET_DEFAULT]. + KmsKey kms_key = 8; + + // Specifies how each object's `timeCreated` metadata is preserved for + // transfers between Google Cloud Storage buckets. If unspecified, the + // default behavior is the same as + // [TIME_CREATED_SKIP][google.storagetransfer.v1.MetadataOptions.TimeCreated.TIME_CREATED_SKIP]. + TimeCreated time_created = 9; +} + +// Specifies where the manifest is located. +message TransferManifest { + // Specifies the path to the manifest in Cloud Storage. The Google-managed + // service account for the transfer must have `storage.objects.get` + // permission for this object. An example path is + // `gs://bucket_name/path/manifest.csv`. + string location = 1; +} + +// Transfers can be scheduled to recur or to run just once. +message Schedule { + // Required. The start date of a transfer. Date boundaries are determined + // relative to UTC time. If `schedule_start_date` and [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day] + // are in the past relative to the job's creation time, the transfer starts + // the day after you schedule the transfer request. + // + // **Note:** When starting jobs at or near midnight UTC it is possible that + // a job starts later than expected. For example, if you send an outbound + // request on June 1 one millisecond prior to midnight UTC and the Storage + // Transfer Service server receives the request on June 2, then it creates + // a TransferJob with `schedule_start_date` set to June 2 and a + // `start_time_of_day` set to midnight UTC. The first scheduled + // [TransferOperation][google.storagetransfer.v1.TransferOperation] takes place on June 3 at midnight UTC. + google.type.Date schedule_start_date = 1 [(google.api.field_behavior) = REQUIRED]; + + // The last day a transfer runs. Date boundaries are determined relative to + // UTC time. A job runs once per 24 hours within the following guidelines: + // + // * If `schedule_end_date` and [schedule_start_date][google.storagetransfer.v1.Schedule.schedule_start_date] are the same and in + // the future relative to UTC, the transfer is executed only one time. + // * If `schedule_end_date` is later than `schedule_start_date` and + // `schedule_end_date` is in the future relative to UTC, the job runs each + // day at [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day] through `schedule_end_date`. + google.type.Date schedule_end_date = 2; + + // The time in UTC that a transfer job is scheduled to run. Transfers may + // start later than this time. + // + // If `start_time_of_day` is not specified: + // + // * One-time transfers run immediately. + // * Recurring transfers run immediately, and each day at midnight UTC, + // through [schedule_end_date][google.storagetransfer.v1.Schedule.schedule_end_date]. + // + // If `start_time_of_day` is specified: + // + // * One-time transfers run at the specified time. + // * Recurring transfers run at the specified time each day, through + // `schedule_end_date`. + google.type.TimeOfDay start_time_of_day = 3; + + // The time in UTC that no further transfer operations are scheduled. Combined + // with [schedule_end_date][google.storagetransfer.v1.Schedule.schedule_end_date], `end_time_of_day` specifies the end date and + // time for starting new transfer operations. This field must be greater than + // or equal to the timestamp corresponding to the combintation of + // [schedule_start_date][google.storagetransfer.v1.Schedule.schedule_start_date] and [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day], and is subject to the + // following: + // + // * If `end_time_of_day` is not set and `schedule_end_date` is set, then + // a default value of `23:59:59` is used for `end_time_of_day`. + // + // * If `end_time_of_day` is set and `schedule_end_date` is not set, then + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] is returned. + google.type.TimeOfDay end_time_of_day = 4; + + // Interval between the start of each scheduled TransferOperation. If + // unspecified, the default value is 24 hours. This value may not be less than + // 1 hour. + google.protobuf.Duration repeat_interval = 5; +} + +// This resource represents the configuration of a transfer job that runs +// periodically. +message TransferJob { + // The status of the transfer job. + enum Status { + // Zero is an illegal value. + STATUS_UNSPECIFIED = 0; + + // New transfers are performed based on the schedule. + ENABLED = 1; + + // New transfers are not scheduled. + DISABLED = 2; + + // This is a soft delete state. After a transfer job is set to this + // state, the job and all the transfer executions are subject to + // garbage collection. Transfer jobs become eligible for garbage collection + // 30 days after their status is set to `DELETED`. + DELETED = 3; + } + + // A unique name (within the transfer project) assigned when the job is + // created. If this field is empty in a CreateTransferJobRequest, Storage + // Transfer Service assigns a unique name. Otherwise, the specified name + // is used as the unique name for this job. + // + // If the specified name is in use by a job, the creation request fails with + // an [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. + // + // This name must start with `"transferJobs/"` prefix and end with a letter or + // a number, and should be no more than 128 characters. For transfers + // involving PosixFilesystem, this name must start with `transferJobs/OPI` + // specifically. For all other transfer types, this name must not start with + // `transferJobs/OPI`. + // + // Non-PosixFilesystem example: + // `"transferJobs/^(?!OPI)[A-Za-z0-9-._~]*[A-Za-z0-9]$"` + // + // PosixFilesystem example: + // `"transferJobs/OPI^[A-Za-z0-9-._~]*[A-Za-z0-9]$"` + // + // Applications must not rely on the enforcement of naming requirements + // involving OPI. + // + // Invalid job names fail with an + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. + string name = 1; + + // A description provided by the user for the job. Its max length is 1024 + // bytes when Unicode-encoded. + string description = 2; + + // The ID of the Google Cloud project that owns the job. + string project_id = 3; + + // Transfer specification. + TransferSpec transfer_spec = 4; + + // Notification configuration. This is not supported for transfers involving + // PosixFilesystem. + NotificationConfig notification_config = 11; + + // Logging configuration. + LoggingConfig logging_config = 14; + + // Specifies schedule for the transfer job. + // This is an optional field. When the field is not set, the job never + // executes a transfer, unless you invoke RunTransferJob or update the job to + // have a non-empty schedule. + Schedule schedule = 5; + + // Status of the job. This value MUST be specified for + // `CreateTransferJobRequests`. + // + // **Note:** The effect of the new job status takes place during a subsequent + // job run. For example, if you change the job status from + // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED] to [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], and an operation + // spawned by the transfer is running, the status change would not affect the + // current operation. + Status status = 6; + + // Output only. The time that the transfer job was created. + google.protobuf.Timestamp creation_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time that the transfer job was last modified. + google.protobuf.Timestamp last_modification_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time that the transfer job was deleted. + google.protobuf.Timestamp deletion_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the most recently started TransferOperation of this JobConfig. + // Present if a TransferOperation has been created for this JobConfig. + string latest_operation_name = 12; +} + +// An entry describing an error that has occurred. +message ErrorLogEntry { + // Required. A URL that refers to the target (a data source, a data sink, + // or an object) with which the error is associated. + string url = 1 [(google.api.field_behavior) = REQUIRED]; + + // A list of messages that carry the error details. + repeated string error_details = 3; +} + +// A summary of errors by error code, plus a count and sample error log +// entries. +message ErrorSummary { + // Required. + google.rpc.Code error_code = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Count of this type of error. + int64 error_count = 2 [(google.api.field_behavior) = REQUIRED]; + + // Error samples. + // + // At most 5 error log entries are recorded for a given + // error code for a single transfer operation. + repeated ErrorLogEntry error_log_entries = 3; +} + +// A collection of counters that report the progress of a transfer operation. +message TransferCounters { + // Objects found in the data source that are scheduled to be transferred, + // excluding any that are filtered based on object conditions or skipped due + // to sync. + int64 objects_found_from_source = 1; + + // Bytes found in the data source that are scheduled to be transferred, + // excluding any that are filtered based on object conditions or skipped due + // to sync. + int64 bytes_found_from_source = 2; + + // Objects found only in the data sink that are scheduled to be deleted. + int64 objects_found_only_from_sink = 3; + + // Bytes found only in the data sink that are scheduled to be deleted. + int64 bytes_found_only_from_sink = 4; + + // Objects in the data source that are not transferred because they already + // exist in the data sink. + int64 objects_from_source_skipped_by_sync = 5; + + // Bytes in the data source that are not transferred because they already + // exist in the data sink. + int64 bytes_from_source_skipped_by_sync = 6; + + // Objects that are copied to the data sink. + int64 objects_copied_to_sink = 7; + + // Bytes that are copied to the data sink. + int64 bytes_copied_to_sink = 8; + + // Objects that are deleted from the data source. + int64 objects_deleted_from_source = 9; + + // Bytes that are deleted from the data source. + int64 bytes_deleted_from_source = 10; + + // Objects that are deleted from the data sink. + int64 objects_deleted_from_sink = 11; + + // Bytes that are deleted from the data sink. + int64 bytes_deleted_from_sink = 12; + + // Objects in the data source that failed to be transferred or that failed + // to be deleted after being transferred. + int64 objects_from_source_failed = 13; + + // Bytes in the data source that failed to be transferred or that failed to + // be deleted after being transferred. + int64 bytes_from_source_failed = 14; + + // Objects that failed to be deleted from the data sink. + int64 objects_failed_to_delete_from_sink = 15; + + // Bytes that failed to be deleted from the data sink. + int64 bytes_failed_to_delete_from_sink = 16; + + // For transfers involving PosixFilesystem only. + // + // Number of directories found while listing. For example, if the root + // directory of the transfer is `base/` and there are two other directories, + // `a/` and `b/` under this directory, the count after listing `base/`, + // `base/a/` and `base/b/` is 3. + int64 directories_found_from_source = 17; + + // For transfers involving PosixFilesystem only. + // + // Number of listing failures for each directory found at the source. + // Potential failures when listing a directory include permission failure or + // block failure. If listing a directory fails, no files in the directory are + // transferred. + int64 directories_failed_to_list_from_source = 18; + + // For transfers involving PosixFilesystem only. + // + // Number of successful listings for each directory found at the source. + int64 directories_successfully_listed_from_source = 19; + + // Number of successfully cleaned up intermediate objects. + int64 intermediate_objects_cleaned_up = 22; + + // Number of intermediate objects failed cleaned up. + int64 intermediate_objects_failed_cleaned_up = 23; +} + +// Specification to configure notifications published to Pub/Sub. +// Notifications are published to the customer-provided topic using the +// following `PubsubMessage.attributes`: +// +// * `"eventType"`: one of the [EventType][google.storagetransfer.v1.NotificationConfig.EventType] values +// * `"payloadFormat"`: one of the [PayloadFormat][google.storagetransfer.v1.NotificationConfig.PayloadFormat] values +// * `"projectId"`: the [project_id][google.storagetransfer.v1.TransferOperation.project_id] of the +// `TransferOperation` +// * `"transferJobName"`: the +// [transfer_job_name][google.storagetransfer.v1.TransferOperation.transfer_job_name] of the +// `TransferOperation` +// * `"transferOperationName"`: the [name][google.storagetransfer.v1.TransferOperation.name] of the +// `TransferOperation` +// +// The `PubsubMessage.data` contains a [TransferOperation][google.storagetransfer.v1.TransferOperation] resource +// formatted according to the specified `PayloadFormat`. +message NotificationConfig { + // Enum for specifying event types for which notifications are to be + // published. + // + // Additional event types may be added in the future. Clients should either + // safely ignore unrecognized event types or explicitly specify which event + // types they are prepared to accept. + enum EventType { + // Illegal value, to avoid allowing a default. + EVENT_TYPE_UNSPECIFIED = 0; + + // `TransferOperation` completed with status + // [SUCCESS][google.storagetransfer.v1.TransferOperation.Status.SUCCESS]. + TRANSFER_OPERATION_SUCCESS = 1; + + // `TransferOperation` completed with status + // [FAILED][google.storagetransfer.v1.TransferOperation.Status.FAILED]. + TRANSFER_OPERATION_FAILED = 2; + + // `TransferOperation` completed with status + // [ABORTED][google.storagetransfer.v1.TransferOperation.Status.ABORTED]. + TRANSFER_OPERATION_ABORTED = 3; + } + + // Enum for specifying the format of a notification message's payload. + enum PayloadFormat { + // Illegal value, to avoid allowing a default. + PAYLOAD_FORMAT_UNSPECIFIED = 0; + + // No payload is included with the notification. + NONE = 1; + + // `TransferOperation` is [formatted as a JSON + // response](https://developers.google.com/protocol-buffers/docs/proto3#json), + // in application/json. + JSON = 2; + } + + // Required. The `Topic.name` of the Pub/Sub topic to which to publish + // notifications. Must be of the format: `projects/{project}/topics/{topic}`. + // Not matching this format results in an + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. + string pubsub_topic = 1 [(google.api.field_behavior) = REQUIRED]; + + // Event types for which a notification is desired. If empty, send + // notifications for all event types. + repeated EventType event_types = 2; + + // Required. The desired format of the notification message payloads. + PayloadFormat payload_format = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies the logging behavior for transfer operations. +// +// For cloud-to-cloud transfers, logs are sent to Cloud Logging. See +// [Read transfer +// logs](https://cloud.google.com/storage-transfer/docs/read-transfer-logs) for +// details. +// +// For transfers to or from a POSIX file system, logs are stored in the +// Cloud Storage bucket that is the source or sink of the transfer. +// See [Managing Transfer for on-premises jobs] +// (https://cloud.google.com/storage-transfer/docs/managing-on-prem-jobs#viewing-logs) +// for details. +message LoggingConfig { + // Loggable actions. + enum LoggableAction { + // Default value. This value is unused. + LOGGABLE_ACTION_UNSPECIFIED = 0; + + // Listing objects in a bucket. + FIND = 1; + + // Deleting objects at the source or the destination. + DELETE = 2; + + // Copying objects to Google Cloud Storage. + COPY = 3; + } + + // Loggable action states. + enum LoggableActionState { + // Default value. This value is unused. + LOGGABLE_ACTION_STATE_UNSPECIFIED = 0; + + // `LoggableAction` completed successfully. `SUCCEEDED` actions are + // logged as [INFO][google.logging.type.LogSeverity.INFO]. + SUCCEEDED = 1; + + // `LoggableAction` terminated in an error state. `FAILED` actions are + // logged as [ERROR][google.logging.type.LogSeverity.ERROR]. + FAILED = 2; + } + + // Specifies the actions to be logged. If empty, no logs are generated. + // Not supported for transfers with PosixFilesystem data sources; use + // [enable_onprem_gcs_transfer_logs][google.storagetransfer.v1.LoggingConfig.enable_onprem_gcs_transfer_logs] instead. + repeated LoggableAction log_actions = 1; + + // States in which `log_actions` are logged. If empty, no logs are generated. + // Not supported for transfers with PosixFilesystem data sources; use + // [enable_onprem_gcs_transfer_logs][google.storagetransfer.v1.LoggingConfig.enable_onprem_gcs_transfer_logs] instead. + repeated LoggableActionState log_action_states = 2; + + // For transfers with a PosixFilesystem source, this option enables the Cloud + // Storage transfer logs for this transfer. + bool enable_onprem_gcs_transfer_logs = 3; +} + +// A description of the execution of a transfer. +message TransferOperation { + // The status of a TransferOperation. + enum Status { + // Zero is an illegal value. + STATUS_UNSPECIFIED = 0; + + // In progress. + IN_PROGRESS = 1; + + // Paused. + PAUSED = 2; + + // Completed successfully. + SUCCESS = 3; + + // Terminated due to an unrecoverable failure. + FAILED = 4; + + // Aborted by the user. + ABORTED = 5; + + // Temporarily delayed by the system. No user action is required. + QUEUED = 6; + } + + // A globally unique ID assigned by the system. + string name = 1; + + // The ID of the Google Cloud project that owns the operation. + string project_id = 2; + + // Transfer specification. + TransferSpec transfer_spec = 3; + + // Notification configuration. + NotificationConfig notification_config = 10; + + // Start time of this transfer execution. + google.protobuf.Timestamp start_time = 4; + + // End time of this transfer execution. + google.protobuf.Timestamp end_time = 5; + + // Status of the transfer operation. + Status status = 6; + + // Information about the progress of the transfer operation. + TransferCounters counters = 7; + + // Summarizes errors encountered with sample error log entries. + repeated ErrorSummary error_breakdowns = 8; + + // The name of the transfer job that triggers this transfer operation. + string transfer_job_name = 9; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json new file mode 100644 index 0000000..5dd0a10 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json @@ -0,0 +1,631 @@ +{ + "clientLibrary": { + "name": "nodejs-storagetransfer", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.storagetransfer.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async", + "title": "StorageTransferService getGoogleServiceAccount Sample", + "origin": "API_DEFINITION", + "description": " Returns the Google service account that is used by Storage Transfer Service to access buckets in the project where transfers run or in other projects. Each Google service account is associated with one Google Cloud project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only be used by Storage Transfer Service.", + "canonical": true, + "file": "storage_transfer_service.get_google_service_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGoogleServiceAccount", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetGoogleServiceAccount", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.GoogleServiceAccount", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "GetGoogleServiceAccount", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetGoogleServiceAccount", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async", + "title": "StorageTransferService createTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Creates a transfer job that runs periodically.", + "canonical": true, + "file": "storage_transfer_service.create_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.CreateTransferJob", + "async": true, + "parameters": [ + { + "name": "transfer_job", + "type": ".google.storagetransfer.v1.TransferJob" + } + ], + "resultType": ".google.storagetransfer.v1.TransferJob", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "CreateTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.CreateTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async", + "title": "StorageTransferService updateTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running already. **Note:** The job's [status][google.storagetransfer.v1.TransferJob.status] field can be modified using this RPC (for example, to set a job's status to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED], [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], or [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]).", + "canonical": true, + "file": "storage_transfer_service.update_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateTransferJob", + "async": true, + "parameters": [ + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "transfer_job", + "type": ".google.storagetransfer.v1.TransferJob" + }, + { + "name": "update_transfer_job_field_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.storagetransfer.v1.TransferJob", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "UpdateTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async", + "title": "StorageTransferService getTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Gets a transfer job.", + "canonical": true, + "file": "storage_transfer_service.get_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetTransferJob", + "async": true, + "parameters": [ + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.TransferJob", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "GetTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async", + "title": "StorageTransferService listTransferJobs Sample", + "origin": "API_DEFINITION", + "description": " Lists transfer jobs.", + "canonical": true, + "file": "storage_transfer_service.list_transfer_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListTransferJobs", + "fullName": "google.storagetransfer.v1.StorageTransferService.ListTransferJobs", + "async": true, + "parameters": [ + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.ListTransferJobsResponse", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "ListTransferJobs", + "fullName": "google.storagetransfer.v1.StorageTransferService.ListTransferJobs", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async", + "title": "StorageTransferService pauseTransferOperation Sample", + "origin": "API_DEFINITION", + "description": " Pauses a transfer operation.", + "canonical": true, + "file": "storage_transfer_service.pause_transfer_operation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PauseTransferOperation", + "fullName": "google.storagetransfer.v1.StorageTransferService.PauseTransferOperation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "PauseTransferOperation", + "fullName": "google.storagetransfer.v1.StorageTransferService.PauseTransferOperation", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async", + "title": "StorageTransferService resumeTransferOperation Sample", + "origin": "API_DEFINITION", + "description": " Resumes a transfer operation that is paused.", + "canonical": true, + "file": "storage_transfer_service.resume_transfer_operation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResumeTransferOperation", + "fullName": "google.storagetransfer.v1.StorageTransferService.ResumeTransferOperation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "ResumeTransferOperation", + "fullName": "google.storagetransfer.v1.StorageTransferService.ResumeTransferOperation", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async", + "title": "StorageTransferService runTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Attempts to start a new TransferOperation for the current TransferJob. A TransferJob has a maximum of one active TransferOperation. If this method is called while a TransferOperation is active, an error will be returned.", + "canonical": true, + "file": "storage_transfer_service.run_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.RunTransferJob", + "async": true, + "parameters": [ + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "RunTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.RunTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async", + "title": "StorageTransferService deleteTransferJob Sample", + "origin": "API_DEFINITION", + "description": " Deletes a transfer job. Deleting a transfer job sets its status to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED].", + "canonical": true, + "file": "storage_transfer_service.delete_transfer_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", + "async": true, + "parameters": [ + { + "name": "job_name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "DeleteTransferJob", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async", + "title": "StorageTransferService createAgentPool Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent pool resource.", + "canonical": true, + "file": "storage_transfer_service.create_agent_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.CreateAgentPool", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "agent_pool", + "type": ".google.storagetransfer.v1.AgentPool" + }, + { + "name": "agent_pool_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.AgentPool", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "CreateAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.CreateAgentPool", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async", + "title": "StorageTransferService updateAgentPool Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing agent pool resource.", + "canonical": true, + "file": "storage_transfer_service.update_agent_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateAgentPool", + "async": true, + "parameters": [ + { + "name": "agent_pool", + "type": ".google.storagetransfer.v1.AgentPool" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.storagetransfer.v1.AgentPool", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "UpdateAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateAgentPool", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async", + "title": "StorageTransferService getAgentPool Sample", + "origin": "API_DEFINITION", + "description": " Gets an agent pool.", + "canonical": true, + "file": "storage_transfer_service.get_agent_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetAgentPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.AgentPool", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "GetAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.GetAgentPool", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async", + "title": "StorageTransferService listAgentPools Sample", + "origin": "API_DEFINITION", + "description": " Lists agent pools.", + "canonical": true, + "file": "storage_transfer_service.list_agent_pools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAgentPools", + "fullName": "google.storagetransfer.v1.StorageTransferService.ListAgentPools", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.storagetransfer.v1.ListAgentPoolsResponse", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "ListAgentPools", + "fullName": "google.storagetransfer.v1.StorageTransferService.ListAgentPools", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + }, + { + "regionTag": "storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async", + "title": "StorageTransferService deleteAgentPool Sample", + "origin": "API_DEFINITION", + "description": " Deletes an agent pool.", + "canonical": true, + "file": "storage_transfer_service.delete_agent_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteAgentPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "StorageTransferServiceClient", + "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" + }, + "method": { + "shortName": "DeleteAgentPool", + "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteAgentPool", + "service": { + "shortName": "StorageTransferService", + "fullName": "google.storagetransfer.v1.StorageTransferService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js new file mode 100644 index 0000000..ed5464a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.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(projectId, agentPool, agentPoolId) { + // [START storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Google Cloud project that owns the + * agent pool. + */ + // const projectId = 'abc123' + /** + * Required. The agent pool to create. + */ + // const agentPool = {} + /** + * Required. The ID of the agent pool to create. + * The `agent_pool_id` must meet the following requirements: + * * Length of 128 characters or less. + * * Not start with the string `goog`. + * * Start with a lowercase ASCII character, followed by: + * * Zero or more: lowercase Latin alphabet characters, numerals, + * hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). + * * One or more numerals or lowercase ASCII characters. + * As expressed by the regular expression: + * `^(?!goog)a-z(a-z0-9-._~*a-z0-9)?$`. + */ + // const agentPoolId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callCreateAgentPool() { + // Construct request + const request = { + projectId, + agentPool, + agentPoolId, + }; + + // Run request + const response = await storagetransferClient.createAgentPool(request); + console.log(response); + } + + callCreateAgentPool(); + // [END storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_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/storage_transfer_service.create_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js new file mode 100644 index 0000000..5daf776 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js @@ -0,0 +1,61 @@ +// 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(transferJob) { + // [START storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The job to create. + */ + // const transferJob = {} + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callCreateTransferJob() { + // Construct request + const request = { + transferJob, + }; + + // Run request + const response = await storagetransferClient.createTransferJob(request); + console.log(response); + } + + callCreateTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_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/storage_transfer_service.delete_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js new file mode 100644 index 0000000..fe2d324 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js @@ -0,0 +1,61 @@ +// 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 storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent pool to delete. + */ + // const name = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callDeleteAgentPool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await storagetransferClient.deleteAgentPool(request); + console.log(response); + } + + callDeleteAgentPool(); + // [END storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_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/storage_transfer_service.delete_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.js new file mode 100644 index 0000000..c70c251 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.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(jobName, projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The job to delete. + */ + // const jobName = 'abc123' + /** + * Required. The ID of the Google Cloud project that owns the + * job. + */ + // const projectId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callDeleteTransferJob() { + // Construct request + const request = { + jobName, + projectId, + }; + + // Run request + const response = await storagetransferClient.deleteTransferJob(request); + console.log(response); + } + + callDeleteTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_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/storage_transfer_service.get_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js new file mode 100644 index 0000000..4b30734 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js @@ -0,0 +1,61 @@ +// 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 storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent pool to get. + */ + // const name = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callGetAgentPool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await storagetransferClient.getAgentPool(request); + console.log(response); + } + + callGetAgentPool(); + // [END storagetransfer_v1_generated_StorageTransferService_GetAgentPool_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/storage_transfer_service.get_google_service_account.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js new file mode 100644 index 0000000..1b8411e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js @@ -0,0 +1,62 @@ +// 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(projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Google Cloud project that the Google service + * account is associated with. + */ + // const projectId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callGetGoogleServiceAccount() { + // Construct request + const request = { + projectId, + }; + + // Run request + const response = await storagetransferClient.getGoogleServiceAccount(request); + console.log(response); + } + + callGetGoogleServiceAccount(); + // [END storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_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/storage_transfer_service.get_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.js new file mode 100644 index 0000000..c7cbd13 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.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(jobName, projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The job to get. + */ + // const jobName = 'abc123' + /** + * Required. The ID of the Google Cloud project that owns the + * job. + */ + // const projectId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callGetTransferJob() { + // Construct request + const request = { + jobName, + projectId, + }; + + // Run request + const response = await storagetransferClient.getTransferJob(request); + console.log(response); + } + + callGetTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_GetTransferJob_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/storage_transfer_service.list_agent_pools.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js new file mode 100644 index 0000000..636a133 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js @@ -0,0 +1,80 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Google Cloud project that owns the job. + */ + // const projectId = 'abc123' + /** + * An optional list of query parameters specified as JSON text in the + * form of: + * `{"agentPoolNames":"agentpool1","agentpool2",... }` + * Since `agentPoolNames` support multiple values, its values must be + * specified with array notation. When the filter is either empty or not + * provided, the list returns all agent pools for the project. + */ + // const filter = 'abc123' + /** + * The list page size. The max allowed value is `256`. + */ + // const pageSize = 1234 + /** + * The list page token. + */ + // const pageToken = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callListAgentPools() { + // Construct request + const request = { + projectId, + }; + + // Run request + const iterable = await storagetransferClient.listAgentPoolsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAgentPools(); + // [END storagetransfer_v1_generated_StorageTransferService_ListAgentPools_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/storage_transfer_service.list_transfer_jobs.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js new file mode 100644 index 0000000..fa1d170 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.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(filter) { + // [START storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A list of query parameters specified as JSON text in the form of: + * `{"projectId":"my_project_id", + * "jobNames":"jobid1","jobid2",..., + * "jobStatuses":"status1","status2",... }` + * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `projectId` is required. + * `jobNames` and `jobStatuses` are optional. The valid values for + * `jobStatuses` are case-insensitive: + * ENABLED google.storagetransfer.v1.TransferJob.Status.ENABLED, + * DISABLED google.storagetransfer.v1.TransferJob.Status.DISABLED, and + * DELETED google.storagetransfer.v1.TransferJob.Status.DELETED. + */ + // const filter = 'abc123' + /** + * The list page size. The max allowed value is 256. + */ + // const pageSize = 1234 + /** + * The list page token. + */ + // const pageToken = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callListTransferJobs() { + // Construct request + const request = { + filter, + }; + + // Run request + const iterable = await storagetransferClient.listTransferJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListTransferJobs(); + // [END storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_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/storage_transfer_service.pause_transfer_operation.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js new file mode 100644 index 0000000..9a11fd3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js @@ -0,0 +1,61 @@ +// 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 storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the transfer operation. + */ + // const name = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callPauseTransferOperation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await storagetransferClient.pauseTransferOperation(request); + console.log(response); + } + + callPauseTransferOperation(); + // [END storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_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/storage_transfer_service.resume_transfer_operation.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js new file mode 100644 index 0000000..565ac82 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js @@ -0,0 +1,61 @@ +// 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 storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the transfer operation. + */ + // const name = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callResumeTransferOperation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await storagetransferClient.resumeTransferOperation(request); + console.log(response); + } + + callResumeTransferOperation(); + // [END storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_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/storage_transfer_service.run_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js new file mode 100644 index 0000000..ce83387 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js @@ -0,0 +1,68 @@ +// 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(jobName, projectId) { + // [START storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the transfer job. + */ + // const jobName = 'abc123' + /** + * Required. The ID of the Google Cloud project that owns the transfer + * job. + */ + // const projectId = 'abc123' + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callRunTransferJob() { + // Construct request + const request = { + jobName, + projectId, + }; + + // Run request + const [operation] = await storagetransferClient.runTransferJob(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_RunTransferJob_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/storage_transfer_service.update_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.js new file mode 100644 index 0000000..b2cf855 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.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(agentPool) { + // [START storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent pool to update. `agent_pool` is expected to specify following + * fields: + * * name google.storagetransfer.v1.AgentPool.name + * * display_name google.storagetransfer.v1.AgentPool.display_name + * * bandwidth_limit google.storagetransfer.v1.AgentPool.bandwidth_limit + * An `UpdateAgentPoolRequest` with any other fields is rejected + * with the error INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. + */ + // const agentPool = {} + /** + * The field mask + * (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) + * of the fields in `agentPool` to update in this request. + * The following `agentPool` fields can be updated: + * * display_name google.storagetransfer.v1.AgentPool.display_name + * * bandwidth_limit google.storagetransfer.v1.AgentPool.bandwidth_limit + */ + // const updateMask = {} + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callUpdateAgentPool() { + // Construct request + const request = { + agentPool, + }; + + // Run request + const response = await storagetransferClient.updateAgentPool(request); + console.log(response); + } + + callUpdateAgentPool(); + // [END storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_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/storage_transfer_service.update_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js new file mode 100644 index 0000000..7961e98 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js @@ -0,0 +1,94 @@ +// 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(jobName, projectId, transferJob) { + // [START storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of job to update. + */ + // const jobName = 'abc123' + /** + * Required. The ID of the Google Cloud project that owns the + * job. + */ + // const projectId = 'abc123' + /** + * Required. The job to update. `transferJob` is expected to specify one or more of + * five fields: description google.storagetransfer.v1.TransferJob.description, + * transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec, + * notification_config google.storagetransfer.v1.TransferJob.notification_config, + * logging_config google.storagetransfer.v1.TransferJob.logging_config, and + * status google.storagetransfer.v1.TransferJob.status. An `UpdateTransferJobRequest` that specifies + * other fields are rejected with the error + * INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. Updating a job status + * to DELETED google.storagetransfer.v1.TransferJob.Status.DELETED requires + * `storagetransfer.jobs.delete` permission. + */ + // const transferJob = {} + /** + * The field mask of the fields in `transferJob` that are to be updated in + * this request. Fields in `transferJob` that can be updated are: + * description google.storagetransfer.v1.TransferJob.description, + * transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec, + * notification_config google.storagetransfer.v1.TransferJob.notification_config, + * logging_config google.storagetransfer.v1.TransferJob.logging_config, and + * status google.storagetransfer.v1.TransferJob.status. To update the `transfer_spec` of the job, a + * complete transfer specification must be provided. An incomplete + * specification missing any required fields is rejected with the error + * INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. + */ + // const updateTransferJobFieldMask = {} + + // Imports the Storagetransfer library + const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; + + // Instantiates a client + const storagetransferClient = new StorageTransferServiceClient(); + + async function callUpdateTransferJob() { + // Construct request + const request = { + jobName, + projectId, + transferJob, + }; + + // Run request + const response = await storagetransferClient.updateTransferJob(request); + console.log(response); + } + + callUpdateTransferJob(); + // [END storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..b2ff704 --- /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 StorageTransferServiceClient = v1.StorageTransferServiceClient; +type StorageTransferServiceClient = v1.StorageTransferServiceClient; +export {v1, StorageTransferServiceClient}; +export default {v1, StorageTransferServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..4155aeb --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,171 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.storagetransfer.v1", + "libraryPackage": "@google-cloud/storage-transfer", + "services": { + "StorageTransferService": { + "clients": { + "grpc": { + "libraryClient": "StorageTransferServiceClient", + "rpcs": { + "GetGoogleServiceAccount": { + "methods": [ + "getGoogleServiceAccount" + ] + }, + "CreateTransferJob": { + "methods": [ + "createTransferJob" + ] + }, + "UpdateTransferJob": { + "methods": [ + "updateTransferJob" + ] + }, + "GetTransferJob": { + "methods": [ + "getTransferJob" + ] + }, + "PauseTransferOperation": { + "methods": [ + "pauseTransferOperation" + ] + }, + "ResumeTransferOperation": { + "methods": [ + "resumeTransferOperation" + ] + }, + "DeleteTransferJob": { + "methods": [ + "deleteTransferJob" + ] + }, + "CreateAgentPool": { + "methods": [ + "createAgentPool" + ] + }, + "UpdateAgentPool": { + "methods": [ + "updateAgentPool" + ] + }, + "GetAgentPool": { + "methods": [ + "getAgentPool" + ] + }, + "DeleteAgentPool": { + "methods": [ + "deleteAgentPool" + ] + }, + "RunTransferJob": { + "methods": [ + "runTransferJob" + ] + }, + "ListTransferJobs": { + "methods": [ + "listTransferJobs", + "listTransferJobsStream", + "listTransferJobsAsync" + ] + }, + "ListAgentPools": { + "methods": [ + "listAgentPools", + "listAgentPoolsStream", + "listAgentPoolsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "StorageTransferServiceClient", + "rpcs": { + "GetGoogleServiceAccount": { + "methods": [ + "getGoogleServiceAccount" + ] + }, + "CreateTransferJob": { + "methods": [ + "createTransferJob" + ] + }, + "UpdateTransferJob": { + "methods": [ + "updateTransferJob" + ] + }, + "GetTransferJob": { + "methods": [ + "getTransferJob" + ] + }, + "PauseTransferOperation": { + "methods": [ + "pauseTransferOperation" + ] + }, + "ResumeTransferOperation": { + "methods": [ + "resumeTransferOperation" + ] + }, + "DeleteTransferJob": { + "methods": [ + "deleteTransferJob" + ] + }, + "CreateAgentPool": { + "methods": [ + "createAgentPool" + ] + }, + "UpdateAgentPool": { + "methods": [ + "updateAgentPool" + ] + }, + "GetAgentPool": { + "methods": [ + "getAgentPool" + ] + }, + "DeleteAgentPool": { + "methods": [ + "deleteAgentPool" + ] + }, + "RunTransferJob": { + "methods": [ + "runTransferJob" + ] + }, + "ListTransferJobs": { + "methods": [ + "listTransferJobs", + "listTransferJobsStream", + "listTransferJobsAsync" + ] + }, + "ListAgentPools": { + "methods": [ + "listAgentPools", + "listAgentPoolsStream", + "listAgentPoolsAsync" + ] + } + } + } + } + } + } +} 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..f0a69d4 --- /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 {StorageTransferServiceClient} from './storage_transfer_service_client'; diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts b/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts new file mode 100644 index 0000000..159d3ff --- /dev/null +++ b/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts @@ -0,0 +1,1916 @@ +// 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/storage_transfer_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './storage_transfer_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Storage Transfer Service and its protos. + * Transfers data between between Google Cloud Storage buckets or from a data + * source external to Google to a Cloud Storage bucket. + * @class + * @memberof v1 + */ +export class StorageTransferServiceClient { + 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; + storageTransferServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of StorageTransferServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new StorageTransferServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof StorageTransferServiceClient; + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPoolsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project_id}/agentPools/{agent_pool_id}' + ), + }; + + // 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 = { + listTransferJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'transferJobs'), + listAgentPools: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'agentPools') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=transferOperations/**}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=transferOperations/**}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=transferOperations}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const runTransferJobResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const runTransferJobMetadata = protoFilesRoot.lookup( + '.google.storagetransfer.v1.TransferOperation') as gax.protobuf.Type; + + this.descriptors.longrunning = { + runTransferJob: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runTransferJobResponse.decode.bind(runTransferJobResponse), + runTransferJobMetadata.decode.bind(runTransferJobMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.storagetransfer.v1.StorageTransferService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.storageTransferServiceStub) { + return this.storageTransferServiceStub; + } + + // Put together the "service stub" for + // google.storagetransfer.v1.StorageTransferService. + this.storageTransferServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.storagetransfer.v1.StorageTransferService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.storagetransfer.v1.StorageTransferService, + 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 storageTransferServiceStubMethods = + ['getGoogleServiceAccount', 'createTransferJob', 'updateTransferJob', 'getTransferJob', 'listTransferJobs', 'pauseTransferOperation', 'resumeTransferOperation', 'runTransferJob', 'deleteTransferJob', 'createAgentPool', 'updateAgentPool', 'getAgentPool', 'listAgentPools', 'deleteAgentPool']; + for (const methodName of storageTransferServiceStubMethods) { + const callPromise = this.storageTransferServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.storageTransferServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'storagetransfer.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 'storagetransfer.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 -- + // ------------------- +/** + * Returns the Google service account that is used by Storage Transfer + * Service to access buckets in the project where transfers + * run or in other projects. Each Google service account is associated + * with one Google Cloud project. Users + * should add this service account to the Google Cloud Storage bucket + * ACLs to grant access to Storage Transfer Service. This service + * account is created and owned by Storage Transfer Service and can + * only be used by Storage Transfer Service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that the Google service + * account is associated with. + * @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 [GoogleServiceAccount]{@link google.storagetransfer.v1.GoogleServiceAccount}. + * 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/storage_transfer_service.get_google_service_account.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async + */ + getGoogleServiceAccount( + request?: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|undefined, {}|undefined + ]>; + getGoogleServiceAccount( + request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, + {}|null|undefined>): void; + getGoogleServiceAccount( + request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, + callback: Callback< + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, + {}|null|undefined>): void; + getGoogleServiceAccount( + request?: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.IGoogleServiceAccount, + protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getGoogleServiceAccount(request, options, callback); + } +/** + * Creates a transfer job that runs periodically. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.storagetransfer.v1.TransferJob} request.transferJob + * Required. The job to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TransferJob]{@link google.storagetransfer.v1.TransferJob}. + * 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/storage_transfer_service.create_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async + */ + createTransferJob( + request?: protos.google.storagetransfer.v1.ICreateTransferJobRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|undefined, {}|undefined + ]>; + createTransferJob( + request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, + {}|null|undefined>): void; + createTransferJob( + request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, + {}|null|undefined>): void; + createTransferJob( + request?: protos.google.storagetransfer.v1.ICreateTransferJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.ICreateTransferJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.createTransferJob(request, options, callback); + } +/** + * Updates a transfer job. Updating a job's transfer spec does not affect + * transfer operations that are running already. + * + * **Note:** The job's {@link google.storagetransfer.v1.TransferJob.status|status} field can be modified + * using this RPC (for example, to set a job's status to + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}, + * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, or + * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.jobName + * Required. The name of job to update. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the + * job. + * @param {google.storagetransfer.v1.TransferJob} request.transferJob + * Required. The job to update. `transferJob` is expected to specify one or more of + * five fields: {@link google.storagetransfer.v1.TransferJob.description|description}, + * {@link google.storagetransfer.v1.TransferJob.transfer_spec|transfer_spec}, + * {@link google.storagetransfer.v1.TransferJob.notification_config|notification_config}, + * {@link google.storagetransfer.v1.TransferJob.logging_config|logging_config}, and + * {@link google.storagetransfer.v1.TransferJob.status|status}. An `UpdateTransferJobRequest` that specifies + * other fields are rejected with the error + * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. Updating a job status + * to {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED} requires + * `storagetransfer.jobs.delete` permission. + * @param {google.protobuf.FieldMask} request.updateTransferJobFieldMask + * The field mask of the fields in `transferJob` that are to be updated in + * this request. Fields in `transferJob` that can be updated are: + * {@link google.storagetransfer.v1.TransferJob.description|description}, + * {@link google.storagetransfer.v1.TransferJob.transfer_spec|transfer_spec}, + * {@link google.storagetransfer.v1.TransferJob.notification_config|notification_config}, + * {@link google.storagetransfer.v1.TransferJob.logging_config|logging_config}, and + * {@link google.storagetransfer.v1.TransferJob.status|status}. To update the `transfer_spec` of the job, a + * complete transfer specification must be provided. An incomplete + * specification missing any required fields is rejected with the error + * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. + * @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 [TransferJob]{@link google.storagetransfer.v1.TransferJob}. + * 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/storage_transfer_service.update_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async + */ + updateTransferJob( + request?: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|undefined, {}|undefined + ]>; + updateTransferJob( + request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, + {}|null|undefined>): void; + updateTransferJob( + request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, + {}|null|undefined>): void; + updateTransferJob( + request?: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IUpdateTransferJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'job_name': request.jobName ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateTransferJob(request, options, callback); + } +/** + * Gets a transfer job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.jobName + * Required. The job to get. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the + * job. + * @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 [TransferJob]{@link google.storagetransfer.v1.TransferJob}. + * 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/storage_transfer_service.get_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async + */ + getTransferJob( + request?: protos.google.storagetransfer.v1.IGetTransferJobRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|undefined, {}|undefined + ]>; + getTransferJob( + request: protos.google.storagetransfer.v1.IGetTransferJobRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, + {}|null|undefined>): void; + getTransferJob( + request: protos.google.storagetransfer.v1.IGetTransferJobRequest, + callback: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, + {}|null|undefined>): void; + getTransferJob( + request?: protos.google.storagetransfer.v1.IGetTransferJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'job_name': request.jobName ?? '', + }); + this.initialize(); + return this.innerApiCalls.getTransferJob(request, options, callback); + } +/** + * Pauses a transfer operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the transfer operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/storage_transfer_service.pause_transfer_operation.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async + */ + pauseTransferOperation( + request?: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|undefined, {}|undefined + ]>; + pauseTransferOperation( + request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, + {}|null|undefined>): void; + pauseTransferOperation( + request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, + {}|null|undefined>): void; + pauseTransferOperation( + request?: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IPauseTransferOperationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.pauseTransferOperation(request, options, callback); + } +/** + * Resumes a transfer operation that is paused. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the transfer operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/storage_transfer_service.resume_transfer_operation.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async + */ + resumeTransferOperation( + request?: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|undefined, {}|undefined + ]>; + resumeTransferOperation( + request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, + {}|null|undefined>): void; + resumeTransferOperation( + request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, + {}|null|undefined>): void; + resumeTransferOperation( + request?: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IResumeTransferOperationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.resumeTransferOperation(request, options, callback); + } +/** + * Deletes a transfer job. Deleting a transfer job sets its status to + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.jobName + * Required. The job to delete. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the + * job. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/storage_transfer_service.delete_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async + */ + deleteTransferJob( + request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|undefined, {}|undefined + ]>; + deleteTransferJob( + request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, + {}|null|undefined>): void; + deleteTransferJob( + request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, + {}|null|undefined>): void; + deleteTransferJob( + request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteTransferJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'job_name': request.jobName ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteTransferJob(request, options, callback); + } +/** + * Creates an agent pool resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the + * agent pool. + * @param {google.storagetransfer.v1.AgentPool} request.agentPool + * Required. The agent pool to create. + * @param {string} request.agentPoolId + * Required. The ID of the agent pool to create. + * + * The `agent_pool_id` must meet the following requirements: + * + * * Length of 128 characters or less. + * * Not start with the string `goog`. + * * Start with a lowercase ASCII character, followed by: + * * Zero or more: lowercase Latin alphabet characters, numerals, + * hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). + * * One or more numerals or lowercase ASCII characters. + * + * As expressed by the regular expression: + * `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`. + * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. + * 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/storage_transfer_service.create_agent_pool.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async + */ + createAgentPool( + request?: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|undefined, {}|undefined + ]>; + createAgentPool( + request: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + createAgentPool( + request: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + createAgentPool( + request?: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + }); + this.initialize(); + return this.innerApiCalls.createAgentPool(request, options, callback); + } +/** + * Updates an existing agent pool resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.storagetransfer.v1.AgentPool} request.agentPool + * Required. The agent pool to update. `agent_pool` is expected to specify following + * fields: + * + * * {@link google.storagetransfer.v1.AgentPool.name|name} + * + * * {@link google.storagetransfer.v1.AgentPool.display_name|display_name} + * + * * {@link google.storagetransfer.v1.AgentPool.bandwidth_limit|bandwidth_limit} + * An `UpdateAgentPoolRequest` with any other fields is rejected + * with the error {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. + * @param {google.protobuf.FieldMask} request.updateMask + * The [field mask] + * (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) + * of the fields in `agentPool` to update in this request. + * The following `agentPool` fields can be updated: + * + * * {@link google.storagetransfer.v1.AgentPool.display_name|display_name} + * + * * {@link google.storagetransfer.v1.AgentPool.bandwidth_limit|bandwidth_limit} + * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. + * 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/storage_transfer_service.update_agent_pool.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async + */ + updateAgentPool( + request?: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|undefined, {}|undefined + ]>; + updateAgentPool( + request: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + updateAgentPool( + request: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + updateAgentPool( + request?: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'agent_pool.name': request.agentPool!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAgentPool(request, options, callback); + } +/** + * Gets an agent pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the agent pool to get. + * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. + * 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/storage_transfer_service.get_agent_pool.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async + */ + getAgentPool( + request?: protos.google.storagetransfer.v1.IGetAgentPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|undefined, {}|undefined + ]>; + getAgentPool( + request: protos.google.storagetransfer.v1.IGetAgentPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + getAgentPool( + request: protos.google.storagetransfer.v1.IGetAgentPoolRequest, + callback: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + getAgentPool( + request?: protos.google.storagetransfer.v1.IGetAgentPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getAgentPool(request, options, callback); + } +/** + * Deletes an agent pool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the agent pool to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/storage_transfer_service.delete_agent_pool.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async + */ + deleteAgentPool( + request?: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|undefined, {}|undefined + ]>; + deleteAgentPool( + request: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + deleteAgentPool( + request: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, + {}|null|undefined>): void; + deleteAgentPool( + request?: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAgentPool(request, options, callback); + } + +/** + * Attempts to start a new TransferOperation for the current TransferJob. A + * TransferJob has a maximum of one active TransferOperation. If this method + * is called while a TransferOperation is active, an error will be returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.jobName + * Required. The name of the transfer job. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the transfer + * job. + * @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/storage_transfer_service.run_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async + */ + runTransferJob( + request?: protos.google.storagetransfer.v1.IRunTransferJobRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runTransferJob( + request: protos.google.storagetransfer.v1.IRunTransferJobRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runTransferJob( + request: protos.google.storagetransfer.v1.IRunTransferJobRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runTransferJob( + request?: protos.google.storagetransfer.v1.IRunTransferJobRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'job_name': request.jobName ?? '', + }); + this.initialize(); + return this.innerApiCalls.runTransferJob(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runTransferJob()`. + * @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/storage_transfer_service.run_transfer_job.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async + */ + async checkRunTransferJobProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runTransferJob, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists transfer jobs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.filter + * Required. A list of query parameters specified as JSON text in the form of: + * `{"projectId":"my_project_id", + * "jobNames":["jobid1","jobid2",...], + * "jobStatuses":["status1","status2",...]}` + * + * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `projectId` is required. + * `jobNames` and `jobStatuses` are optional. The valid values for + * `jobStatuses` are case-insensitive: + * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, + * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * @param {number} request.pageSize + * The list page size. The max allowed value is 256. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [TransferJob]{@link google.storagetransfer.v1.TransferJob}. + * 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 `listTransferJobsAsync()` + * 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. + */ + listTransferJobs( + request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob[], + protos.google.storagetransfer.v1.IListTransferJobsRequest|null, + protos.google.storagetransfer.v1.IListTransferJobsResponse + ]>; + listTransferJobs( + request: protos.google.storagetransfer.v1.IListTransferJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.storagetransfer.v1.IListTransferJobsRequest, + protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, + protos.google.storagetransfer.v1.ITransferJob>): void; + listTransferJobs( + request: protos.google.storagetransfer.v1.IListTransferJobsRequest, + callback: PaginationCallback< + protos.google.storagetransfer.v1.IListTransferJobsRequest, + protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, + protos.google.storagetransfer.v1.ITransferJob>): void; + listTransferJobs( + request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.storagetransfer.v1.IListTransferJobsRequest, + protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, + protos.google.storagetransfer.v1.ITransferJob>, + callback?: PaginationCallback< + protos.google.storagetransfer.v1.IListTransferJobsRequest, + protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, + protos.google.storagetransfer.v1.ITransferJob>): + Promise<[ + protos.google.storagetransfer.v1.ITransferJob[], + protos.google.storagetransfer.v1.IListTransferJobsRequest|null, + protos.google.storagetransfer.v1.IListTransferJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.listTransferJobs(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.filter + * Required. A list of query parameters specified as JSON text in the form of: + * `{"projectId":"my_project_id", + * "jobNames":["jobid1","jobid2",...], + * "jobStatuses":["status1","status2",...]}` + * + * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `projectId` is required. + * `jobNames` and `jobStatuses` are optional. The valid values for + * `jobStatuses` are case-insensitive: + * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, + * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * @param {number} request.pageSize + * The list page size. The max allowed value is 256. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [TransferJob]{@link google.storagetransfer.v1.TransferJob} 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 `listTransferJobsAsync()` + * 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. + */ + listTransferJobsStream( + request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listTransferJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTransferJobs.createStream( + this.innerApiCalls.listTransferJobs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTransferJobs`, 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.filter + * Required. A list of query parameters specified as JSON text in the form of: + * `{"projectId":"my_project_id", + * "jobNames":["jobid1","jobid2",...], + * "jobStatuses":["status1","status2",...]}` + * + * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `projectId` is required. + * `jobNames` and `jobStatuses` are optional. The valid values for + * `jobStatuses` are case-insensitive: + * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, + * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and + * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * @param {number} request.pageSize + * The list page size. The max allowed value is 256. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [TransferJob]{@link google.storagetransfer.v1.TransferJob}. 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/storage_transfer_service.list_transfer_jobs.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async + */ + listTransferJobsAsync( + request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listTransferJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTransferJobs.asyncIterate( + this.innerApiCalls['listTransferJobs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists agent pools. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud project that owns the job. + * @param {string} request.filter + * An optional list of query parameters specified as JSON text in the + * form of: + * + * `{"agentPoolNames":["agentpool1","agentpool2",...]}` + * + * Since `agentPoolNames` support multiple values, its values must be + * specified with array notation. When the filter is either empty or not + * provided, the list returns all agent pools for the project. + * @param {number} request.pageSize + * The list page size. The max allowed value is `256`. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [AgentPool]{@link google.storagetransfer.v1.AgentPool}. + * 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 `listAgentPoolsAsync()` + * 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. + */ + listAgentPools( + request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + options?: CallOptions): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool[], + protos.google.storagetransfer.v1.IListAgentPoolsRequest|null, + protos.google.storagetransfer.v1.IListAgentPoolsResponse + ]>; + listAgentPools( + request: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.storagetransfer.v1.IListAgentPoolsRequest, + protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, + protos.google.storagetransfer.v1.IAgentPool>): void; + listAgentPools( + request: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + callback: PaginationCallback< + protos.google.storagetransfer.v1.IListAgentPoolsRequest, + protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, + protos.google.storagetransfer.v1.IAgentPool>): void; + listAgentPools( + request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.storagetransfer.v1.IListAgentPoolsRequest, + protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, + protos.google.storagetransfer.v1.IAgentPool>, + callback?: PaginationCallback< + protos.google.storagetransfer.v1.IListAgentPoolsRequest, + protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, + protos.google.storagetransfer.v1.IAgentPool>): + Promise<[ + protos.google.storagetransfer.v1.IAgentPool[], + protos.google.storagetransfer.v1.IListAgentPoolsRequest|null, + protos.google.storagetransfer.v1.IListAgentPoolsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + }); + this.initialize(); + return this.innerApiCalls.listAgentPools(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.projectId + * Required. The ID of the Google Cloud project that owns the job. + * @param {string} request.filter + * An optional list of query parameters specified as JSON text in the + * form of: + * + * `{"agentPoolNames":["agentpool1","agentpool2",...]}` + * + * Since `agentPoolNames` support multiple values, its values must be + * specified with array notation. When the filter is either empty or not + * provided, the list returns all agent pools for the project. + * @param {number} request.pageSize + * The list page size. The max allowed value is `256`. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [AgentPool]{@link google.storagetransfer.v1.AgentPool} 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 `listAgentPoolsAsync()` + * 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. + */ + listAgentPoolsStream( + request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + }); + const defaultCallSettings = this._defaults['listAgentPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAgentPools.createStream( + this.innerApiCalls.listAgentPools as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAgentPools`, 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.projectId + * Required. The ID of the Google Cloud project that owns the job. + * @param {string} request.filter + * An optional list of query parameters specified as JSON text in the + * form of: + * + * `{"agentPoolNames":["agentpool1","agentpool2",...]}` + * + * Since `agentPoolNames` support multiple values, its values must be + * specified with array notation. When the filter is either empty or not + * provided, the list returns all agent pools for the project. + * @param {number} request.pageSize + * The list page size. The max allowed value is `256`. + * @param {string} request.pageToken + * The list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [AgentPool]{@link google.storagetransfer.v1.AgentPool}. 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/storage_transfer_service.list_agent_pools.js + * region_tag:storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async + */ + listAgentPoolsAsync( + request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + }); + const defaultCallSettings = this._defaults['listAgentPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAgentPools.asyncIterate( + this.innerApiCalls['listAgentPools'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agentPools resource name string. + * + * @param {string} project_id + * @param {string} agent_pool_id + * @returns {string} Resource name string. + */ + agentPoolsPath(projectId:string,agentPoolId:string) { + return this.pathTemplates.agentPoolsPathTemplate.render({ + project_id: projectId, + agent_pool_id: agentPoolId, + }); + } + + /** + * Parse the project_id from AgentPools resource. + * + * @param {string} agentPoolsName + * A fully-qualified path representing agentPools resource. + * @returns {string} A string representing the project_id. + */ + matchProjectIdFromAgentPoolsName(agentPoolsName: string) { + return this.pathTemplates.agentPoolsPathTemplate.match(agentPoolsName).project_id; + } + + /** + * Parse the agent_pool_id from AgentPools resource. + * + * @param {string} agentPoolsName + * A fully-qualified path representing agentPools resource. + * @returns {string} A string representing the agent_pool_id. + */ + matchAgentPoolIdFromAgentPoolsName(agentPoolsName: string) { + return this.pathTemplates.agentPoolsPathTemplate.match(agentPoolsName).agent_pool_id; + } + + /** + * 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.storageTransferServiceStub && !this._terminated) { + return this.storageTransferServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json b/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json new file mode 100644 index 0000000..93b4537 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json @@ -0,0 +1,108 @@ +{ + "interfaces": { + "google.storagetransfer.v1.StorageTransferService": { + "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 + }, + "264268458a9e88347dbacbd9398202ff5885a40b": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 2, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetGoogleServiceAccount": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "CreateTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "GetTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListTransferJobs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "PauseTransferOperation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ResumeTransferOperation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "RunTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteTransferJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "CreateAgentPool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "UpdateAgentPool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "GetAgentPool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListAgentPools": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteAgentPool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json b/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json new file mode 100644 index 0000000..ea755b4 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/storagetransfer/v1/transfer.proto", + "../../protos/google/storagetransfer/v1/transfer_types.proto" +] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..842da4d --- /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 storagetransfer = require('@google-cloud/storage-transfer'); + +function main() { + const storageTransferServiceClient = new storagetransfer.StorageTransferServiceClient(); +} + +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..458ee50 --- /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 {StorageTransferServiceClient} from '@google-cloud/storage-transfer'; + +// check that the client class type name can be used +function doStuffWithStorageTransferServiceClient(client: StorageTransferServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const storageTransferServiceClient = new StorageTransferServiceClient(); + doStuffWithStorageTransferServiceClient(storageTransferServiceClient); +} + +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..557a575 --- /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_storage_transfer_service_v1.ts b/owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts new file mode 100644 index 0000000..b782c5b --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts @@ -0,0 +1,2242 @@ +// 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 storagetransferserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.StorageTransferServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = storagetransferserviceModule.v1.StorageTransferServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = storagetransferserviceModule.v1.StorageTransferServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = storagetransferserviceModule.v1.StorageTransferServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.storageTransferServiceStub, undefined); + await client.initialize(); + assert(client.storageTransferServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.storageTransferServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.storageTransferServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + 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 storagetransferserviceModule.v1.StorageTransferServiceClient({ + 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('getGoogleServiceAccount', () => { + it('invokes getGoogleServiceAccount without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetGoogleServiceAccountRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.GoogleServiceAccount() + ); + client.innerApiCalls.getGoogleServiceAccount = stubSimpleCall(expectedResponse); + const [response] = await client.getGoogleServiceAccount(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGoogleServiceAccount without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetGoogleServiceAccountRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.GoogleServiceAccount() + ); + client.innerApiCalls.getGoogleServiceAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGoogleServiceAccount( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IGoogleServiceAccount|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGoogleServiceAccount with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetGoogleServiceAccountRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGoogleServiceAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGoogleServiceAccount(request), expectedError); + const actualRequest = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGoogleServiceAccount with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetGoogleServiceAccountRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getGoogleServiceAccount(request), expectedError); + }); + }); + + describe('createTransferJob', () => { + it('invokes createTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.CreateTransferJobRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.TransferJob() + ); + client.innerApiCalls.createTransferJob = stubSimpleCall(expectedResponse); + const [response] = await client.createTransferJob(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes createTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.CreateTransferJobRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.TransferJob() + ); + client.innerApiCalls.createTransferJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTransferJob( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes createTransferJob with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.CreateTransferJobRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.createTransferJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createTransferJob(request), expectedError); + }); + + it('invokes createTransferJob with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.CreateTransferJobRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createTransferJob(request), expectedError); + }); + }); + + describe('updateTransferJob', () => { + it('invokes updateTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.UpdateTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('UpdateTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.TransferJob() + ); + client.innerApiCalls.updateTransferJob = stubSimpleCall(expectedResponse); + const [response] = await client.updateTransferJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.UpdateTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('UpdateTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.TransferJob() + ); + client.innerApiCalls.updateTransferJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTransferJob( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTransferJob with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.UpdateTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('UpdateTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTransferJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateTransferJob(request), expectedError); + const actualRequest = (client.innerApiCalls.updateTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateTransferJob with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.UpdateTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('UpdateTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateTransferJob(request), expectedError); + }); + }); + + describe('getTransferJob', () => { + it('invokes getTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.TransferJob() + ); + client.innerApiCalls.getTransferJob = stubSimpleCall(expectedResponse); + const [response] = await client.getTransferJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.TransferJob() + ); + client.innerApiCalls.getTransferJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTransferJob( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTransferJob with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getTransferJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTransferJob(request), expectedError); + const actualRequest = (client.innerApiCalls.getTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTransferJob with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getTransferJob(request), expectedError); + }); + }); + + describe('pauseTransferOperation', () => { + it('invokes pauseTransferOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.PauseTransferOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('PauseTransferOperationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.pauseTransferOperation = stubSimpleCall(expectedResponse); + const [response] = await client.pauseTransferOperation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.pauseTransferOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.pauseTransferOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pauseTransferOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.PauseTransferOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('PauseTransferOperationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.pauseTransferOperation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pauseTransferOperation( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.pauseTransferOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.pauseTransferOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pauseTransferOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.PauseTransferOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('PauseTransferOperationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.pauseTransferOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.pauseTransferOperation(request), expectedError); + const actualRequest = (client.innerApiCalls.pauseTransferOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.pauseTransferOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pauseTransferOperation with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.PauseTransferOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('PauseTransferOperationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.pauseTransferOperation(request), expectedError); + }); + }); + + describe('resumeTransferOperation', () => { + it('invokes resumeTransferOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ResumeTransferOperationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.resumeTransferOperation = stubSimpleCall(expectedResponse); + const [response] = await client.resumeTransferOperation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resumeTransferOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resumeTransferOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resumeTransferOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ResumeTransferOperationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.resumeTransferOperation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resumeTransferOperation( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resumeTransferOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resumeTransferOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resumeTransferOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ResumeTransferOperationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resumeTransferOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.resumeTransferOperation(request), expectedError); + const actualRequest = (client.innerApiCalls.resumeTransferOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resumeTransferOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resumeTransferOperation with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ResumeTransferOperationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.resumeTransferOperation(request), expectedError); + }); + }); + + describe('deleteTransferJob', () => { + it('invokes deleteTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTransferJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTransferJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTransferJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTransferJob( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTransferJob with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTransferJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteTransferJob(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteTransferJob with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteTransferJob(request), expectedError); + }); + }); + + describe('createAgentPool', () => { + it('invokes createAgentPool without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.CreateAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateAgentPoolRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.AgentPool() + ); + client.innerApiCalls.createAgentPool = stubSimpleCall(expectedResponse); + const [response] = await client.createAgentPool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAgentPool without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.CreateAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateAgentPoolRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.AgentPool() + ); + client.innerApiCalls.createAgentPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAgentPool( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAgentPool with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.CreateAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateAgentPoolRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAgentPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createAgentPool(request), expectedError); + const actualRequest = (client.innerApiCalls.createAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAgentPool with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.CreateAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateAgentPoolRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createAgentPool(request), expectedError); + }); + }); + + describe('updateAgentPool', () => { + it('invokes updateAgentPool without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() + ); + request.agentPool ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateAgentPoolRequest', ['agentPool', 'name']); + request.agentPool.name = defaultValue1; + const expectedHeaderRequestParams = `agent_pool.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.AgentPool() + ); + client.innerApiCalls.updateAgentPool = stubSimpleCall(expectedResponse); + const [response] = await client.updateAgentPool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAgentPool without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() + ); + request.agentPool ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateAgentPoolRequest', ['agentPool', 'name']); + request.agentPool.name = defaultValue1; + const expectedHeaderRequestParams = `agent_pool.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.AgentPool() + ); + client.innerApiCalls.updateAgentPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAgentPool( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAgentPool with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() + ); + request.agentPool ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateAgentPoolRequest', ['agentPool', 'name']); + request.agentPool.name = defaultValue1; + const expectedHeaderRequestParams = `agent_pool.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAgentPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAgentPool(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAgentPool with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() + ); + request.agentPool ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateAgentPoolRequest', ['agentPool', 'name']); + request.agentPool.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateAgentPool(request), expectedError); + }); + }); + + describe('getAgentPool', () => { + it('invokes getAgentPool without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetAgentPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.AgentPool() + ); + client.innerApiCalls.getAgentPool = stubSimpleCall(expectedResponse); + const [response] = await client.getAgentPool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgentPool without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetAgentPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.storagetransfer.v1.AgentPool() + ); + client.innerApiCalls.getAgentPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAgentPool( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgentPool with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetAgentPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAgentPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAgentPool(request), expectedError); + const actualRequest = (client.innerApiCalls.getAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgentPool with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.GetAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetAgentPoolRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAgentPool(request), expectedError); + }); + }); + + describe('deleteAgentPool', () => { + it('invokes deleteAgentPool without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteAgentPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgentPool = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAgentPool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgentPool without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteAgentPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgentPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAgentPool( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgentPool with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteAgentPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAgentPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAgentPool(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAgentPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAgentPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgentPool with closed client', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteAgentPoolRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAgentPool(request), expectedError); + }); + }); + + describe('runTransferJob', () => { + it('invokes runTransferJob without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.RunTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RunTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runTransferJob = stubLongRunningCall(expectedResponse); + const [operation] = await client.runTransferJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runTransferJob without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.RunTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RunTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runTransferJob = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runTransferJob( + 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); + const actualRequest = (client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runTransferJob with call error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.RunTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RunTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runTransferJob = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runTransferJob(request), expectedError); + const actualRequest = (client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runTransferJob with LRO error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.RunTransferJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RunTransferJobRequest', ['jobName']); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runTransferJob = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runTransferJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runTransferJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRunTransferJobProgress without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + 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.checkRunTransferJobProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunTransferJobProgress with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + 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.checkRunTransferJobProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listTransferJobs', () => { + it('invokes listTransferJobs without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListTransferJobsRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + ]; + client.innerApiCalls.listTransferJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listTransferJobs(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listTransferJobs without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListTransferJobsRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + ]; + client.innerApiCalls.listTransferJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTransferJobs( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes listTransferJobs with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListTransferJobsRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listTransferJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTransferJobs(request), expectedError); + }); + + it('invokes listTransferJobsStream without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListTransferJobsRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + ]; + client.descriptors.page.listTransferJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTransferJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.storagetransfer.v1.TransferJob[] = []; + stream.on('data', (response: protos.google.storagetransfer.v1.TransferJob) => { + 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.listTransferJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTransferJobs, request)); + }); + + it('invokes listTransferJobsStream with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListTransferJobsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listTransferJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTransferJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.storagetransfer.v1.TransferJob[] = []; + stream.on('data', (response: protos.google.storagetransfer.v1.TransferJob) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTransferJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTransferJobs, request)); + }); + + it('uses async iteration with listTransferJobs without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListTransferJobsRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), + ]; + client.descriptors.page.listTransferJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.storagetransfer.v1.ITransferJob[] = []; + const iterable = client.listTransferJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTransferJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + + it('uses async iteration with listTransferJobs with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListTransferJobsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listTransferJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTransferJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.storagetransfer.v1.ITransferJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTransferJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('listAgentPools', () => { + it('invokes listAgentPools without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListAgentPoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + ]; + client.innerApiCalls.listAgentPools = stubSimpleCall(expectedResponse); + const [response] = await client.listAgentPools(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAgentPools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAgentPools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAgentPools without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListAgentPoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + ]; + client.innerApiCalls.listAgentPools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAgentPools( + request, + (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAgentPools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAgentPools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAgentPools with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListAgentPoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAgentPools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAgentPools(request), expectedError); + const actualRequest = (client.innerApiCalls.listAgentPools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAgentPools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAgentPoolsStream without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListAgentPoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + ]; + client.descriptors.page.listAgentPools.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAgentPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.storagetransfer.v1.AgentPool[] = []; + stream.on('data', (response: protos.google.storagetransfer.v1.AgentPool) => { + 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.listAgentPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAgentPools, request)); + assert( + (client.descriptors.page.listAgentPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAgentPoolsStream with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListAgentPoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAgentPools.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAgentPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.storagetransfer.v1.AgentPool[] = []; + stream.on('data', (response: protos.google.storagetransfer.v1.AgentPool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAgentPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAgentPools, request)); + assert( + (client.descriptors.page.listAgentPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAgentPools without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListAgentPoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), + ]; + client.descriptors.page.listAgentPools.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.storagetransfer.v1.IAgentPool[] = []; + const iterable = client.listAgentPoolsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAgentPools with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.storagetransfer.v1.ListAgentPoolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAgentPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAgentPoolsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.storagetransfer.v1.IAgentPool[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('agentPools', () => { + const fakePath = "/rendered/path/agentPools"; + const expectedParameters = { + project_id: "projectIdValue", + agent_pool_id: "agentPoolIdValue", + }; + const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPoolsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.agentPoolsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('agentPoolsPath', () => { + const result = client.agentPoolsPath("projectIdValue", "agentPoolIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.agentPoolsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectIdFromAgentPoolsName', () => { + const result = client.matchProjectIdFromAgentPoolsName(fakePath); + assert.strictEqual(result, "projectIdValue"); + assert((client.pathTemplates.agentPoolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAgentPoolIdFromAgentPoolsName', () => { + const result = client.matchAgentPoolIdFromAgentPoolsName(fakePath); + assert.strictEqual(result, "agentPoolIdValue"); + assert((client.pathTemplates.agentPoolsPathTemplate.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..08a3efc --- /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: 'StorageTransferService', + filename: './storage-transfer-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 93e0e45d5bfccd6b975861b3d7bd5258e9a7564a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 14 Sep 2022 20:25:53 +0000 Subject: [PATCH 4/4] =?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 - .../google/storagetransfer/v1/transfer.proto | 387 --- .../storagetransfer/v1/transfer_types.proto | 1227 --------- ...et_metadata.google.storagetransfer.v1.json | 631 ----- ...rage_transfer_service.create_agent_pool.js | 81 - ...ge_transfer_service.create_transfer_job.js | 61 - ...rage_transfer_service.delete_agent_pool.js | 61 - ...ge_transfer_service.delete_transfer_job.js | 67 - ...storage_transfer_service.get_agent_pool.js | 61 - ...sfer_service.get_google_service_account.js | 62 - ...orage_transfer_service.get_transfer_job.js | 67 - ...orage_transfer_service.list_agent_pools.js | 80 - ...age_transfer_service.list_transfer_jobs.js | 81 - ...ansfer_service.pause_transfer_operation.js | 61 - ...nsfer_service.resume_transfer_operation.js | 61 - ...orage_transfer_service.run_transfer_job.js | 68 - ...rage_transfer_service.update_agent_pool.js | 76 - ...ge_transfer_service.update_transfer_job.js | 94 - owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 171 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../src/v1/storage_transfer_service_client.ts | 1916 -------------- ...torage_transfer_service_client_config.json | 108 - .../storage_transfer_service_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../test/gapic_storage_transfer_service_v1.ts | 2242 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - src/v1/storage_transfer_service_client.ts | 28 +- test/gapic_storage_transfer_service_v1.ts | 1196 ++++----- 40 files changed, 614 insertions(+), 8727 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/storagetransfer/v1/transfer.proto delete mode 100644 owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/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 0ffbf58..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/storage-transfer', - 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 dc9f51c..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Storagetransfer: 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 aa30966..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/storage-transfer", - "version": "0.1.0", - "description": "Storagetransfer client for Node.js", - "repository": "googleapis/nodejs-storagetransfer", - "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 storagetransfer", - "storagetransfer", - "storage transfer service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "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.5.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.59", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto deleted file mode 100644 index 802cc10..0000000 --- a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer.proto +++ /dev/null @@ -1,387 +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 -// -// 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.storagetransfer.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/storagetransfer/v1/transfer_types.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; -option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; -option java_outer_classname = "TransferProto"; -option java_package = "com.google.storagetransfer.v1.proto"; -option php_namespace = "Google\\Cloud\\StorageTransfer\\V1"; -option ruby_package = "Google::Cloud::StorageTransfer::V1"; - -// Storage Transfer Service and its protos. -// Transfers data between between Google Cloud Storage buckets or from a data -// source external to Google to a Cloud Storage bucket. -service StorageTransferService { - option (google.api.default_host) = "storagetransfer.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Returns the Google service account that is used by Storage Transfer - // Service to access buckets in the project where transfers - // run or in other projects. Each Google service account is associated - // with one Google Cloud project. Users - // should add this service account to the Google Cloud Storage bucket - // ACLs to grant access to Storage Transfer Service. This service - // account is created and owned by Storage Transfer Service and can - // only be used by Storage Transfer Service. - rpc GetGoogleServiceAccount(GetGoogleServiceAccountRequest) returns (GoogleServiceAccount) { - option (google.api.http) = { - get: "/v1/googleServiceAccounts/{project_id}" - }; - } - - // Creates a transfer job that runs periodically. - rpc CreateTransferJob(CreateTransferJobRequest) returns (TransferJob) { - option (google.api.http) = { - post: "/v1/transferJobs" - body: "transfer_job" - }; - } - - // Updates a transfer job. Updating a job's transfer spec does not affect - // transfer operations that are running already. - // - // **Note:** The job's [status][google.storagetransfer.v1.TransferJob.status] field can be modified - // using this RPC (for example, to set a job's status to - // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED], - // [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], or - // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]). - rpc UpdateTransferJob(UpdateTransferJobRequest) returns (TransferJob) { - option (google.api.http) = { - patch: "/v1/{job_name=transferJobs/**}" - body: "*" - }; - } - - // Gets a transfer job. - rpc GetTransferJob(GetTransferJobRequest) returns (TransferJob) { - option (google.api.http) = { - get: "/v1/{job_name=transferJobs/**}" - }; - } - - // Lists transfer jobs. - rpc ListTransferJobs(ListTransferJobsRequest) returns (ListTransferJobsResponse) { - option (google.api.http) = { - get: "/v1/transferJobs" - }; - } - - // Pauses a transfer operation. - rpc PauseTransferOperation(PauseTransferOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=transferOperations/**}:pause" - body: "*" - }; - } - - // Resumes a transfer operation that is paused. - rpc ResumeTransferOperation(ResumeTransferOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=transferOperations/**}:resume" - body: "*" - }; - } - - // Attempts to start a new TransferOperation for the current TransferJob. A - // TransferJob has a maximum of one active TransferOperation. If this method - // is called while a TransferOperation is active, an error will be returned. - rpc RunTransferJob(RunTransferJobRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{job_name=transferJobs/**}:run" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "TransferOperation" - }; - } - - // Deletes a transfer job. Deleting a transfer job sets its status to - // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. - rpc DeleteTransferJob(DeleteTransferJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{job_name=transferJobs/**}" - }; - } - - // Creates an agent pool resource. - rpc CreateAgentPool(CreateAgentPoolRequest) returns (AgentPool) { - option (google.api.http) = { - post: "/v1/projects/{project_id=*}/agentPools" - body: "agent_pool" - }; - option (google.api.method_signature) = "project_id,agent_pool,agent_pool_id"; - } - - // Updates an existing agent pool resource. - rpc UpdateAgentPool(UpdateAgentPoolRequest) returns (AgentPool) { - option (google.api.http) = { - patch: "/v1/{agent_pool.name=projects/*/agentPools/*}" - body: "agent_pool" - }; - option (google.api.method_signature) = "agent_pool,update_mask"; - } - - // Gets an agent pool. - rpc GetAgentPool(GetAgentPoolRequest) returns (AgentPool) { - option (google.api.http) = { - get: "/v1/{name=projects/*/agentPools/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists agent pools. - rpc ListAgentPools(ListAgentPoolsRequest) returns (ListAgentPoolsResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id=*}/agentPools" - }; - option (google.api.method_signature) = "project_id"; - } - - // Deletes an agent pool. - rpc DeleteAgentPool(DeleteAgentPoolRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/agentPools/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request passed to GetGoogleServiceAccount. -message GetGoogleServiceAccountRequest { - // Required. The ID of the Google Cloud project that the Google service - // account is associated with. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to CreateTransferJob. -message CreateTransferJobRequest { - // Required. The job to create. - TransferJob transfer_job = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to UpdateTransferJob. -message UpdateTransferJobRequest { - // Required. The name of job to update. - string job_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the Google Cloud project that owns the - // job. - string project_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The job to update. `transferJob` is expected to specify one or more of - // five fields: [description][google.storagetransfer.v1.TransferJob.description], - // [transfer_spec][google.storagetransfer.v1.TransferJob.transfer_spec], - // [notification_config][google.storagetransfer.v1.TransferJob.notification_config], - // [logging_config][google.storagetransfer.v1.TransferJob.logging_config], and - // [status][google.storagetransfer.v1.TransferJob.status]. An `UpdateTransferJobRequest` that specifies - // other fields are rejected with the error - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. Updating a job status - // to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED] requires - // `storagetransfer.jobs.delete` permission. - TransferJob transfer_job = 3 [(google.api.field_behavior) = REQUIRED]; - - // The field mask of the fields in `transferJob` that are to be updated in - // this request. Fields in `transferJob` that can be updated are: - // [description][google.storagetransfer.v1.TransferJob.description], - // [transfer_spec][google.storagetransfer.v1.TransferJob.transfer_spec], - // [notification_config][google.storagetransfer.v1.TransferJob.notification_config], - // [logging_config][google.storagetransfer.v1.TransferJob.logging_config], and - // [status][google.storagetransfer.v1.TransferJob.status]. To update the `transfer_spec` of the job, a - // complete transfer specification must be provided. An incomplete - // specification missing any required fields is rejected with the error - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. - google.protobuf.FieldMask update_transfer_job_field_mask = 4; -} - -// Request passed to GetTransferJob. -message GetTransferJobRequest { - // Required. The job to get. - string job_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the Google Cloud project that owns the - // job. - string project_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to DeleteTransferJob. -message DeleteTransferJobRequest { - // Required. The job to delete. - string job_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the Google Cloud project that owns the - // job. - string project_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// `projectId`, `jobNames`, and `jobStatuses` are query parameters that can -// be specified when listing transfer jobs. -message ListTransferJobsRequest { - // Required. A list of query parameters specified as JSON text in the form of: - // `{"projectId":"my_project_id", - // "jobNames":["jobid1","jobid2",...], - // "jobStatuses":["status1","status2",...]}` - // - // Since `jobNames` and `jobStatuses` support multiple values, their values - // must be specified with array notation. `projectId` is required. - // `jobNames` and `jobStatuses` are optional. The valid values for - // `jobStatuses` are case-insensitive: - // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED], - // [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], and - // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. - string filter = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list page size. The max allowed value is 256. - int32 page_size = 4; - - // The list page token. - string page_token = 5; -} - -// Response from ListTransferJobs. -message ListTransferJobsResponse { - // A list of transfer jobs. - repeated TransferJob transfer_jobs = 1; - - // The list next page token. - string next_page_token = 2; -} - -// Request passed to PauseTransferOperation. -message PauseTransferOperationRequest { - // Required. The name of the transfer operation. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to ResumeTransferOperation. -message ResumeTransferOperationRequest { - // Required. The name of the transfer operation. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request passed to RunTransferJob. -message RunTransferJobRequest { - // Required. The name of the transfer job. - string job_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the Google Cloud project that owns the transfer - // job. - string project_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies the request passed to CreateAgentPool. -message CreateAgentPoolRequest { - // Required. The ID of the Google Cloud project that owns the - // agent pool. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The agent pool to create. - AgentPool agent_pool = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the agent pool to create. - // - // The `agent_pool_id` must meet the following requirements: - // - // * Length of 128 characters or less. - // * Not start with the string `goog`. - // * Start with a lowercase ASCII character, followed by: - // * Zero or more: lowercase Latin alphabet characters, numerals, - // hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). - // * One or more numerals or lowercase ASCII characters. - // - // As expressed by the regular expression: - // `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`. - string agent_pool_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies the request passed to UpdateAgentPool. -message UpdateAgentPoolRequest { - // Required. The agent pool to update. `agent_pool` is expected to specify following - // fields: - // - // * [name][google.storagetransfer.v1.AgentPool.name] - // - // * [display_name][google.storagetransfer.v1.AgentPool.display_name] - // - // * [bandwidth_limit][google.storagetransfer.v1.AgentPool.bandwidth_limit] - // An `UpdateAgentPoolRequest` with any other fields is rejected - // with the error [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. - AgentPool agent_pool = 1 [(google.api.field_behavior) = REQUIRED]; - - // The [field mask] - // (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) - // of the fields in `agentPool` to update in this request. - // The following `agentPool` fields can be updated: - // - // * [display_name][google.storagetransfer.v1.AgentPool.display_name] - // - // * [bandwidth_limit][google.storagetransfer.v1.AgentPool.bandwidth_limit] - google.protobuf.FieldMask update_mask = 2; -} - -// Specifies the request passed to GetAgentPool. -message GetAgentPoolRequest { - // Required. The name of the agent pool to get. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies the request passed to DeleteAgentPool. -message DeleteAgentPoolRequest { - // Required. The name of the agent pool to delete. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request passed to ListAgentPools. -message ListAgentPoolsRequest { - // Required. The ID of the Google Cloud project that owns the job. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // An optional list of query parameters specified as JSON text in the - // form of: - // - // `{"agentPoolNames":["agentpool1","agentpool2",...]}` - // - // Since `agentPoolNames` support multiple values, its values must be - // specified with array notation. When the filter is either empty or not - // provided, the list returns all agent pools for the project. - string filter = 2; - - // The list page size. The max allowed value is `256`. - int32 page_size = 3; - - // The list page token. - string page_token = 4; -} - -// Response from ListAgentPools. -message ListAgentPoolsResponse { - // A list of agent pools. - repeated AgentPool agent_pools = 1; - - // The list next page token. - string next_page_token = 2; -} diff --git a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto b/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto deleted file mode 100644 index 4e1a3b5..0000000 --- a/owl-bot-staging/v1/protos/google/storagetransfer/v1/transfer_types.proto +++ /dev/null @@ -1,1227 +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 -// -// 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.storagetransfer.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/code.proto"; -import "google/type/date.proto"; -import "google/type/timeofday.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; -option go_package = "google.golang.org/genproto/googleapis/storagetransfer/v1;storagetransfer"; -option java_outer_classname = "TransferTypes"; -option java_package = "com.google.storagetransfer.v1.proto"; -option php_namespace = "Google\\Cloud\\StorageTransfer\\V1"; -option ruby_package = "Google::Cloud::StorageTransfer::V1"; - -// Google service account -message GoogleServiceAccount { - // Email address of the service account. - string account_email = 1; - - // Unique identifier for the service account. - string subject_id = 2; -} - -// AWS access key (see -// [AWS Security -// Credentials](https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)). -// -// For information on our data retention policy for user credentials, see -// [User credentials](/storage-transfer/docs/data-retention#user-credentials). -message AwsAccessKey { - // Required. AWS access key ID. - string access_key_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. AWS secret access key. This field is not returned in RPC - // responses. - string secret_access_key = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Azure credentials -// -// For information on our data retention policy for user credentials, see -// [User credentials](/storage-transfer/docs/data-retention#user-credentials). -message AzureCredentials { - // Required. Azure shared access signature (SAS). - // - // For more information about SAS, see - // [Grant limited access to Azure Storage resources using shared access - // signatures - // (SAS)](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview). - string sas_token = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Conditions that determine which objects are transferred. Applies only -// to Cloud Data Sources such as S3, Azure, and Cloud Storage. -// -// The "last modification time" refers to the time of the -// last change to the object's content or metadata — specifically, this is -// the `updated` property of Cloud Storage objects, the `LastModified` field -// of S3 objects, and the `Last-Modified` header of Azure blobs. -// -// Transfers with a [PosixFilesystem][google.storagetransfer.v1.PosixFilesystem] source or destination don't support -// `ObjectConditions`. -message ObjectConditions { - // Ensures that objects are not transferred until a specific minimum time - // has elapsed after the "last modification time". When a - // [TransferOperation][google.storagetransfer.v1.TransferOperation] begins, objects with a "last modification time" are - // transferred only if the elapsed time between the - // [start_time][google.storagetransfer.v1.TransferOperation.start_time] of the `TransferOperation` - // and the "last modification time" of the object is equal to or - // greater than the value of min_time_elapsed_since_last_modification`. - // Objects that do not have a "last modification time" are also transferred. - google.protobuf.Duration min_time_elapsed_since_last_modification = 1; - - // Ensures that objects are not transferred if a specific maximum time - // has elapsed since the "last modification time". - // When a [TransferOperation][google.storagetransfer.v1.TransferOperation] begins, objects with a - // "last modification time" are transferred only if the elapsed time - // between the [start_time][google.storagetransfer.v1.TransferOperation.start_time] of the - // `TransferOperation`and the "last modification time" of the object - // is less than the value of max_time_elapsed_since_last_modification`. - // Objects that do not have a "last modification time" are also transferred. - google.protobuf.Duration max_time_elapsed_since_last_modification = 2; - - // If you specify `include_prefixes`, Storage Transfer Service uses the items - // in the `include_prefixes` array to determine which objects to include in a - // transfer. Objects must start with one of the matching `include_prefixes` - // for inclusion in the transfer. If [exclude_prefixes][google.storagetransfer.v1.ObjectConditions.exclude_prefixes] is specified, - // objects must not start with any of the `exclude_prefixes` specified for - // inclusion in the transfer. - // - // The following are requirements of `include_prefixes`: - // - // * Each include-prefix can contain any sequence of Unicode characters, to - // a max length of 1024 bytes when UTF8-encoded, and must not contain - // Carriage Return or Line Feed characters. Wildcard matching and regular - // expression matching are not supported. - // - // * Each include-prefix must omit the leading slash. For example, to - // include the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, - // specify the include-prefix as `logs/y=2015/requests.gz`. - // - // * None of the include-prefix values can be empty, if specified. - // - // * Each include-prefix must include a distinct portion of the object - // namespace. No include-prefix may be a prefix of another - // include-prefix. - // - // The max size of `include_prefixes` is 1000. - // - // For more information, see [Filtering objects from - // transfers](/storage-transfer/docs/filtering-objects-from-transfers). - repeated string include_prefixes = 3; - - // If you specify `exclude_prefixes`, Storage Transfer Service uses the items - // in the `exclude_prefixes` array to determine which objects to exclude from - // a transfer. Objects must not start with one of the matching - // `exclude_prefixes` for inclusion in a transfer. - // - // The following are requirements of `exclude_prefixes`: - // - // * Each exclude-prefix can contain any sequence of Unicode characters, to - // a max length of 1024 bytes when UTF8-encoded, and must not contain - // Carriage Return or Line Feed characters. Wildcard matching and regular - // expression matching are not supported. - // - // * Each exclude-prefix must omit the leading slash. For example, to - // exclude the object `s3://my-aws-bucket/logs/y=2015/requests.gz`, - // specify the exclude-prefix as `logs/y=2015/requests.gz`. - // - // * None of the exclude-prefix values can be empty, if specified. - // - // * Each exclude-prefix must exclude a distinct portion of the object - // namespace. No exclude-prefix may be a prefix of another - // exclude-prefix. - // - // * If [include_prefixes][google.storagetransfer.v1.ObjectConditions.include_prefixes] is specified, then each exclude-prefix must - // start with the value of a path explicitly included by `include_prefixes`. - // - // The max size of `exclude_prefixes` is 1000. - // - // For more information, see [Filtering objects from - // transfers](/storage-transfer/docs/filtering-objects-from-transfers). - repeated string exclude_prefixes = 4; - - // If specified, only objects with a "last modification time" on or after - // this timestamp and objects that don't have a "last modification time" are - // transferred. - // - // The `last_modified_since` and `last_modified_before` fields can be used - // together for chunked data processing. For example, consider a script that - // processes each day's worth of data at a time. For that you'd set each - // of the fields as follows: - // - // * `last_modified_since` to the start of the day - // - // * `last_modified_before` to the end of the day - google.protobuf.Timestamp last_modified_since = 5; - - // If specified, only objects with a "last modification time" before this - // timestamp and objects that don't have a "last modification time" are - // transferred. - google.protobuf.Timestamp last_modified_before = 6; -} - -// In a GcsData resource, an object's name is the Cloud Storage object's -// name and its "last modification time" refers to the object's `updated` -// property of Cloud Storage objects, which changes when the content or the -// metadata of the object is updated. -message GcsData { - // Required. Cloud Storage bucket name. Must meet - // [Bucket Name Requirements](/storage/docs/naming#requirements). - string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Root path to transfer objects. - // - // Must be an empty string or full path name that ends with a '/'. This field - // is treated as an object prefix. As such, it should generally not begin with - // a '/'. - // - // The root path value must meet - // [Object Name Requirements](/storage/docs/naming#objectnames). - string path = 3; -} - -// An AwsS3Data resource can be a data source, but not a data sink. -// In an AwsS3Data resource, an object's name is the S3 object's key name. -message AwsS3Data { - // Required. S3 Bucket name (see - // [Creating a - // bucket](https://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-get-location-example.html)). - string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Input only. AWS access key used to sign the API requests to the AWS S3 bucket. - // Permissions on the bucket must be granted to the access ID of the AWS - // access key. - // - // For information on our data retention policy for user credentials, see - // [User credentials](/storage-transfer/docs/data-retention#user-credentials). - AwsAccessKey aws_access_key = 2 [(google.api.field_behavior) = INPUT_ONLY]; - - // Root path to transfer objects. - // - // Must be an empty string or full path name that ends with a '/'. This field - // is treated as an object prefix. As such, it should generally not begin with - // a '/'. - string path = 3; - - // The Amazon Resource Name (ARN) of the role to support temporary - // credentials via `AssumeRoleWithWebIdentity`. For more information about - // ARNs, see [IAM - // ARNs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns). - // - // When a role ARN is provided, Transfer Service fetches temporary - // credentials for the session using a `AssumeRoleWithWebIdentity` call for - // the provided role using the [GoogleServiceAccount][google.storagetransfer.v1.GoogleServiceAccount] for this project. - string role_arn = 4; -} - -// An AzureBlobStorageData resource can be a data source, but not a data sink. -// An AzureBlobStorageData resource represents one Azure container. The storage -// account determines the [Azure -// endpoint](https://docs.microsoft.com/en-us/azure/storage/common/storage-create-storage-account#storage-account-endpoints). -// In an AzureBlobStorageData resource, a blobs's name is the [Azure Blob -// Storage blob's key -// name](https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#blob-names). -message AzureBlobStorageData { - // Required. The name of the Azure Storage account. - string storage_account = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. Credentials used to authenticate API requests to Azure. - // - // For information on our data retention policy for user credentials, see - // [User credentials](/storage-transfer/docs/data-retention#user-credentials). - AzureCredentials azure_credentials = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - - // Required. The container to transfer from the Azure Storage account. - string container = 4 [(google.api.field_behavior) = REQUIRED]; - - // Root path to transfer objects. - // - // Must be an empty string or full path name that ends with a '/'. This field - // is treated as an object prefix. As such, it should generally not begin with - // a '/'. - string path = 5; -} - -// An HttpData resource specifies a list of objects on the web to be transferred -// over HTTP. The information of the objects to be transferred is contained in -// a file referenced by a URL. The first line in the file must be -// `"TsvHttpData-1.0"`, which specifies the format of the file. Subsequent -// lines specify the information of the list of objects, one object per list -// entry. Each entry has the following tab-delimited fields: -// -// * **HTTP URL** — The location of the object. -// -// * **Length** — The size of the object in bytes. -// -// * **MD5** — The base64-encoded MD5 hash of the object. -// -// For an example of a valid TSV file, see -// [Transferring data from -// URLs](https://cloud.google.com/storage-transfer/docs/create-url-list). -// -// When transferring data based on a URL list, keep the following in mind: -// -// * When an object located at `http(s)://hostname:port/` is -// transferred to a data sink, the name of the object at the data sink is -// `/`. -// -// * If the specified size of an object does not match the actual size of the -// object fetched, the object is not transferred. -// -// * If the specified MD5 does not match the MD5 computed from the transferred -// bytes, the object transfer fails. -// -// * Ensure that each URL you specify is publicly accessible. For -// example, in Cloud Storage you can -// [share an object publicly] -// (/storage/docs/cloud-console#_sharingdata) and get a link to it. -// -// * Storage Transfer Service obeys `robots.txt` rules and requires the source -// HTTP server to support `Range` requests and to return a `Content-Length` -// header in each response. -// -// * [ObjectConditions][google.storagetransfer.v1.ObjectConditions] have no effect when filtering objects to transfer. -message HttpData { - // Required. The URL that points to the file that stores the object list - // entries. This file must allow public access. Currently, only URLs with - // HTTP and HTTPS schemes are supported. - string list_url = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// A POSIX filesystem resource. -message PosixFilesystem { - // Root directory path to the filesystem. - string root_directory = 1; -} - -// An AwsS3CompatibleData resource. -message AwsS3CompatibleData { - // Required. Specifies the name of the bucket. - string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Specifies the root path to transfer objects. - // - // Must be an empty string or full path name that ends with a '/'. This - // field is treated as an object prefix. As such, it should generally not - // begin with a '/'. - string path = 2; - - // Required. Specifies the endpoint of the storage service. - string endpoint = 3 [(google.api.field_behavior) = REQUIRED]; - - // Specifies the region to sign requests with. This can be left blank if - // requests should be signed with an empty region. - string region = 5; - - // Specifies the metadata of the S3 compatible data provider. Each provider - // may contain some attributes that do not apply to all S3-compatible data - // providers. When not specified, S3CompatibleMetadata is used by default. - oneof data_provider { - // A S3 compatible metadata. - S3CompatibleMetadata s3_metadata = 4; - } -} - -// S3CompatibleMetadata contains the metadata fields that apply to the basic -// types of S3-compatible data providers. -message S3CompatibleMetadata { - // The authentication and authorization method used by the storage service. - enum AuthMethod { - // AuthMethod is not specified. - AUTH_METHOD_UNSPECIFIED = 0; - - // Auth requests with AWS SigV4. - AUTH_METHOD_AWS_SIGNATURE_V4 = 1; - - // Auth requests with AWS SigV2. - AUTH_METHOD_AWS_SIGNATURE_V2 = 2; - } - - // The request model of the API. - enum RequestModel { - // RequestModel is not specified. - REQUEST_MODEL_UNSPECIFIED = 0; - - // Perform requests using Virtual Hosted Style. - // Example: https://bucket-name.s3.region.amazonaws.com/key-name - REQUEST_MODEL_VIRTUAL_HOSTED_STYLE = 1; - - // Perform requests using Path Style. - // Example: https://s3.region.amazonaws.com/bucket-name/key-name - REQUEST_MODEL_PATH_STYLE = 2; - } - - // The agent network protocol to access the storage service. - enum NetworkProtocol { - // NetworkProtocol is not specified. - NETWORK_PROTOCOL_UNSPECIFIED = 0; - - // Perform requests using HTTPS. - NETWORK_PROTOCOL_HTTPS = 1; - - // Not recommended: This sends data in clear-text. This is only - // appropriate within a closed network or for publicly available data. - // Perform requests using HTTP. - NETWORK_PROTOCOL_HTTP = 2; - } - - // The Listing API to use for discovering objects. - enum ListApi { - // ListApi is not specified. - LIST_API_UNSPECIFIED = 0; - - // Perform listing using ListObjectsV2 API. - LIST_OBJECTS_V2 = 1; - - // Legacy ListObjects API. - LIST_OBJECTS = 2; - } - - // Specifies the authentication and authorization method used by the storage - // service. When not specified, Transfer Service will attempt to determine - // right auth method to use. - AuthMethod auth_method = 1; - - // Specifies the API request model used to call the storage service. When not - // specified, the default value of RequestModel - // REQUEST_MODEL_VIRTUAL_HOSTED_STYLE is used. - RequestModel request_model = 2; - - // Specifies the network protocol of the agent. When not specified, the - // default value of NetworkProtocol NETWORK_PROTOCOL_HTTPS is used. - NetworkProtocol protocol = 3; - - // The Listing API to use for discovering objects. When not specified, - // Transfer Service will attempt to determine the right API to use. - ListApi list_api = 4; -} - -// Represents an On-Premises Agent pool. -message AgentPool { - option (google.api.resource) = { - type: "storagetransfer.googleapis.com/agentPools" - pattern: "projects/{project_id}/agentPools/{agent_pool_id}" - }; - - // The state of an AgentPool. - enum State { - // Default value. This value is unused. - STATE_UNSPECIFIED = 0; - - // This is an initialization state. During this stage, the resources such as - // Pub/Sub topics are allocated for the AgentPool. - CREATING = 1; - - // Determines that the AgentPool is created for use. At this state, Agents - // can join the AgentPool and participate in the transfer jobs in that pool. - CREATED = 2; - - // Determines that the AgentPool deletion has been initiated, and all the - // resources are scheduled to be cleaned up and freed. - DELETING = 3; - } - - // Specifies a bandwidth limit for an agent pool. - message BandwidthLimit { - // Bandwidth rate in megabytes per second, distributed across all the agents - // in the pool. - int64 limit_mbps = 1; - } - - // Required. Specifies a unique string that identifies the agent pool. - // - // Format: `projects/{project_id}/agentPools/{agent_pool_id}` - string name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Specifies the client-specified AgentPool description. - string display_name = 3; - - // Output only. Specifies the state of the AgentPool. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Specifies the bandwidth limit details. If this field is unspecified, the - // default value is set as 'No Limit'. - BandwidthLimit bandwidth_limit = 5; -} - -// TransferOptions define the actions to be performed on objects in a transfer. -message TransferOptions { - // Specifies when to overwrite an object in the sink when an object with - // matching name is found in the source. - enum OverwriteWhen { - // Overwrite behavior is unspecified. - OVERWRITE_WHEN_UNSPECIFIED = 0; - - // Overwrites destination objects with the source objects, only if the - // objects have the same name but different HTTP ETags or checksum values. - DIFFERENT = 1; - - // Never overwrites a destination object if a source object has the - // same name. In this case, the source object is not transferred. - NEVER = 2; - - // Always overwrite the destination object with the source object, even if - // the HTTP Etags or checksum values are the same. - ALWAYS = 3; - } - - // When to overwrite objects that already exist in the sink. The default is - // that only objects that are different from the source are ovewritten. If - // true, all objects in the sink whose name matches an object in the source - // are overwritten with the source object. - bool overwrite_objects_already_existing_in_sink = 1; - - // Whether objects that exist only in the sink should be deleted. - // - // **Note:** This option and [delete_objects_from_source_after_transfer][google.storagetransfer.v1.TransferOptions.delete_objects_from_source_after_transfer] are - // mutually exclusive. - bool delete_objects_unique_in_sink = 2; - - // Whether objects should be deleted from the source after they are - // transferred to the sink. - // - // **Note:** This option and [delete_objects_unique_in_sink][google.storagetransfer.v1.TransferOptions.delete_objects_unique_in_sink] are mutually - // exclusive. - bool delete_objects_from_source_after_transfer = 3; - - // When to overwrite objects that already exist in the sink. If not set, - // overwrite behavior is determined by - // [overwrite_objects_already_existing_in_sink][google.storagetransfer.v1.TransferOptions.overwrite_objects_already_existing_in_sink]. - OverwriteWhen overwrite_when = 4; - - // Represents the selected metadata options for a transfer job. - MetadataOptions metadata_options = 5; -} - -// Configuration for running a transfer. -message TransferSpec { - // The write sink for the data. - oneof data_sink { - // A Cloud Storage data sink. - GcsData gcs_data_sink = 4; - - // A POSIX Filesystem data sink. - PosixFilesystem posix_data_sink = 13; - } - - // The read source of the data. - oneof data_source { - // A Cloud Storage data source. - GcsData gcs_data_source = 1; - - // An AWS S3 data source. - AwsS3Data aws_s3_data_source = 2; - - // An HTTP URL data source. - HttpData http_data_source = 3; - - // A POSIX Filesystem data source. - PosixFilesystem posix_data_source = 14; - - // An Azure Blob Storage data source. - AzureBlobStorageData azure_blob_storage_data_source = 8; - - // An AWS S3 compatible data source. - AwsS3CompatibleData aws_s3_compatible_data_source = 19; - } - - // Represents a supported data container type which is required for transfer - // jobs which needs a data source, a data sink and an intermediate location to - // transfer data through. This is validated on TransferJob creation. - oneof intermediate_data_location { - // Cloud Storage intermediate data location. - GcsData gcs_intermediate_data_location = 16; - } - - // Only objects that satisfy these object conditions are included in the set - // of data source and data sink objects. Object conditions based on - // objects' "last modification time" do not exclude objects in a data sink. - ObjectConditions object_conditions = 5; - - // If the option - // [delete_objects_unique_in_sink][google.storagetransfer.v1.TransferOptions.delete_objects_unique_in_sink] - // is `true` and time-based object conditions such as 'last modification time' - // are specified, the request fails with an - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. - TransferOptions transfer_options = 6; - - // A manifest file provides a list of objects to be transferred from the data - // source. This field points to the location of the manifest file. - // Otherwise, the entire source bucket is used. ObjectConditions still apply. - TransferManifest transfer_manifest = 15; - - // Specifies the agent pool name associated with the posix data source. When - // unspecified, the default name is used. - string source_agent_pool_name = 17; - - // Specifies the agent pool name associated with the posix data sink. When - // unspecified, the default name is used. - string sink_agent_pool_name = 18; -} - -// Specifies the metadata options for running a transfer. -message MetadataOptions { - // Whether symlinks should be skipped or preserved during a transfer job. - enum Symlink { - // Symlink behavior is unspecified. - SYMLINK_UNSPECIFIED = 0; - - // Do not preserve symlinks during a transfer job. - SYMLINK_SKIP = 1; - - // Preserve symlinks during a transfer job. - SYMLINK_PRESERVE = 2; - } - - // Options for handling file mode attribute. - enum Mode { - // Mode behavior is unspecified. - MODE_UNSPECIFIED = 0; - - // Do not preserve mode during a transfer job. - MODE_SKIP = 1; - - // Preserve mode during a transfer job. - MODE_PRESERVE = 2; - } - - // Options for handling file GID attribute. - enum GID { - // GID behavior is unspecified. - GID_UNSPECIFIED = 0; - - // Do not preserve GID during a transfer job. - GID_SKIP = 1; - - // Preserve GID during a transfer job. - GID_NUMBER = 2; - } - - // Options for handling file UID attribute. - enum UID { - // UID behavior is unspecified. - UID_UNSPECIFIED = 0; - - // Do not preserve UID during a transfer job. - UID_SKIP = 1; - - // Preserve UID during a transfer job. - UID_NUMBER = 2; - } - - // Options for handling Cloud Storage object ACLs. - enum Acl { - // ACL behavior is unspecified. - ACL_UNSPECIFIED = 0; - - // Use the destination bucket's default object ACLS, if applicable. - ACL_DESTINATION_BUCKET_DEFAULT = 1; - - // Preserve the object's original ACLs. This requires the service account - // to have `storage.objects.getIamPolicy` permission for the source object. - // [Uniform bucket-level - // access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) - // must not be enabled on either the source or destination buckets. - ACL_PRESERVE = 2; - } - - // Options for handling Google Cloud Storage object storage class. - enum StorageClass { - // Storage class behavior is unspecified. - STORAGE_CLASS_UNSPECIFIED = 0; - - // Use the destination bucket's default storage class. - STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT = 1; - - // Preserve the object's original storage class. This is only supported for - // transfers from Google Cloud Storage buckets. - STORAGE_CLASS_PRESERVE = 2; - - // Set the storage class to STANDARD. - STORAGE_CLASS_STANDARD = 3; - - // Set the storage class to NEARLINE. - STORAGE_CLASS_NEARLINE = 4; - - // Set the storage class to COLDLINE. - STORAGE_CLASS_COLDLINE = 5; - - // Set the storage class to ARCHIVE. - STORAGE_CLASS_ARCHIVE = 6; - } - - // Options for handling temporary holds for Google Cloud Storage objects. - enum TemporaryHold { - // Temporary hold behavior is unspecified. - TEMPORARY_HOLD_UNSPECIFIED = 0; - - // Do not set a temporary hold on the destination object. - TEMPORARY_HOLD_SKIP = 1; - - // Preserve the object's original temporary hold status. - TEMPORARY_HOLD_PRESERVE = 2; - } - - // Options for handling the KmsKey setting for Google Cloud Storage objects. - enum KmsKey { - // KmsKey behavior is unspecified. - KMS_KEY_UNSPECIFIED = 0; - - // Use the destination bucket's default encryption settings. - KMS_KEY_DESTINATION_BUCKET_DEFAULT = 1; - - // Preserve the object's original Cloud KMS customer-managed encryption key - // (CMEK) if present. Objects that do not use a Cloud KMS encryption key - // will be encrypted using the destination bucket's encryption settings. - KMS_KEY_PRESERVE = 2; - } - - // Options for handling `timeCreated` metadata for Google Cloud Storage - // objects. - enum TimeCreated { - // TimeCreated behavior is unspecified. - TIME_CREATED_UNSPECIFIED = 0; - - // Do not preserve the `timeCreated` metadata from the source object. - TIME_CREATED_SKIP = 1; - - // Preserves the source object's `timeCreated` metadata in the `customTime` - // field in the destination object. Note that any value stored in the - // source object's `customTime` field will not be propagated to the - // destination object. - TIME_CREATED_PRESERVE_AS_CUSTOM_TIME = 2; - } - - // Specifies how symlinks should be handled by the transfer. By default, - // symlinks are not preserved. Only applicable to transfers involving - // POSIX file systems, and ignored for other transfers. - Symlink symlink = 1; - - // Specifies how each file's mode attribute should be handled by the transfer. - // By default, mode is not preserved. Only applicable to transfers involving - // POSIX file systems, and ignored for other transfers. - Mode mode = 2; - - // Specifies how each file's POSIX group ID (GID) attribute should be handled - // by the transfer. By default, GID is not preserved. Only applicable to - // transfers involving POSIX file systems, and ignored for other transfers. - GID gid = 3; - - // Specifies how each file's POSIX user ID (UID) attribute should be handled - // by the transfer. By default, UID is not preserved. Only applicable to - // transfers involving POSIX file systems, and ignored for other transfers. - UID uid = 4; - - // Specifies how each object's ACLs should be preserved for transfers between - // Google Cloud Storage buckets. If unspecified, the default behavior is the - // same as ACL_DESTINATION_BUCKET_DEFAULT. - Acl acl = 5; - - // Specifies the storage class to set on objects being transferred to Google - // Cloud Storage buckets. If unspecified, the default behavior is the same as - // [STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT][google.storagetransfer.v1.MetadataOptions.StorageClass.STORAGE_CLASS_DESTINATION_BUCKET_DEFAULT]. - StorageClass storage_class = 6; - - // Specifies how each object's temporary hold status should be preserved for - // transfers between Google Cloud Storage buckets. If unspecified, the - // default behavior is the same as - // [TEMPORARY_HOLD_PRESERVE][google.storagetransfer.v1.MetadataOptions.TemporaryHold.TEMPORARY_HOLD_PRESERVE]. - TemporaryHold temporary_hold = 7; - - // Specifies how each object's Cloud KMS customer-managed encryption key - // (CMEK) is preserved for transfers between Google Cloud Storage buckets. If - // unspecified, the default behavior is the same as - // [KMS_KEY_DESTINATION_BUCKET_DEFAULT][google.storagetransfer.v1.MetadataOptions.KmsKey.KMS_KEY_DESTINATION_BUCKET_DEFAULT]. - KmsKey kms_key = 8; - - // Specifies how each object's `timeCreated` metadata is preserved for - // transfers between Google Cloud Storage buckets. If unspecified, the - // default behavior is the same as - // [TIME_CREATED_SKIP][google.storagetransfer.v1.MetadataOptions.TimeCreated.TIME_CREATED_SKIP]. - TimeCreated time_created = 9; -} - -// Specifies where the manifest is located. -message TransferManifest { - // Specifies the path to the manifest in Cloud Storage. The Google-managed - // service account for the transfer must have `storage.objects.get` - // permission for this object. An example path is - // `gs://bucket_name/path/manifest.csv`. - string location = 1; -} - -// Transfers can be scheduled to recur or to run just once. -message Schedule { - // Required. The start date of a transfer. Date boundaries are determined - // relative to UTC time. If `schedule_start_date` and [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day] - // are in the past relative to the job's creation time, the transfer starts - // the day after you schedule the transfer request. - // - // **Note:** When starting jobs at or near midnight UTC it is possible that - // a job starts later than expected. For example, if you send an outbound - // request on June 1 one millisecond prior to midnight UTC and the Storage - // Transfer Service server receives the request on June 2, then it creates - // a TransferJob with `schedule_start_date` set to June 2 and a - // `start_time_of_day` set to midnight UTC. The first scheduled - // [TransferOperation][google.storagetransfer.v1.TransferOperation] takes place on June 3 at midnight UTC. - google.type.Date schedule_start_date = 1 [(google.api.field_behavior) = REQUIRED]; - - // The last day a transfer runs. Date boundaries are determined relative to - // UTC time. A job runs once per 24 hours within the following guidelines: - // - // * If `schedule_end_date` and [schedule_start_date][google.storagetransfer.v1.Schedule.schedule_start_date] are the same and in - // the future relative to UTC, the transfer is executed only one time. - // * If `schedule_end_date` is later than `schedule_start_date` and - // `schedule_end_date` is in the future relative to UTC, the job runs each - // day at [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day] through `schedule_end_date`. - google.type.Date schedule_end_date = 2; - - // The time in UTC that a transfer job is scheduled to run. Transfers may - // start later than this time. - // - // If `start_time_of_day` is not specified: - // - // * One-time transfers run immediately. - // * Recurring transfers run immediately, and each day at midnight UTC, - // through [schedule_end_date][google.storagetransfer.v1.Schedule.schedule_end_date]. - // - // If `start_time_of_day` is specified: - // - // * One-time transfers run at the specified time. - // * Recurring transfers run at the specified time each day, through - // `schedule_end_date`. - google.type.TimeOfDay start_time_of_day = 3; - - // The time in UTC that no further transfer operations are scheduled. Combined - // with [schedule_end_date][google.storagetransfer.v1.Schedule.schedule_end_date], `end_time_of_day` specifies the end date and - // time for starting new transfer operations. This field must be greater than - // or equal to the timestamp corresponding to the combintation of - // [schedule_start_date][google.storagetransfer.v1.Schedule.schedule_start_date] and [start_time_of_day][google.storagetransfer.v1.Schedule.start_time_of_day], and is subject to the - // following: - // - // * If `end_time_of_day` is not set and `schedule_end_date` is set, then - // a default value of `23:59:59` is used for `end_time_of_day`. - // - // * If `end_time_of_day` is set and `schedule_end_date` is not set, then - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] is returned. - google.type.TimeOfDay end_time_of_day = 4; - - // Interval between the start of each scheduled TransferOperation. If - // unspecified, the default value is 24 hours. This value may not be less than - // 1 hour. - google.protobuf.Duration repeat_interval = 5; -} - -// This resource represents the configuration of a transfer job that runs -// periodically. -message TransferJob { - // The status of the transfer job. - enum Status { - // Zero is an illegal value. - STATUS_UNSPECIFIED = 0; - - // New transfers are performed based on the schedule. - ENABLED = 1; - - // New transfers are not scheduled. - DISABLED = 2; - - // This is a soft delete state. After a transfer job is set to this - // state, the job and all the transfer executions are subject to - // garbage collection. Transfer jobs become eligible for garbage collection - // 30 days after their status is set to `DELETED`. - DELETED = 3; - } - - // A unique name (within the transfer project) assigned when the job is - // created. If this field is empty in a CreateTransferJobRequest, Storage - // Transfer Service assigns a unique name. Otherwise, the specified name - // is used as the unique name for this job. - // - // If the specified name is in use by a job, the creation request fails with - // an [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. - // - // This name must start with `"transferJobs/"` prefix and end with a letter or - // a number, and should be no more than 128 characters. For transfers - // involving PosixFilesystem, this name must start with `transferJobs/OPI` - // specifically. For all other transfer types, this name must not start with - // `transferJobs/OPI`. - // - // Non-PosixFilesystem example: - // `"transferJobs/^(?!OPI)[A-Za-z0-9-._~]*[A-Za-z0-9]$"` - // - // PosixFilesystem example: - // `"transferJobs/OPI^[A-Za-z0-9-._~]*[A-Za-z0-9]$"` - // - // Applications must not rely on the enforcement of naming requirements - // involving OPI. - // - // Invalid job names fail with an - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. - string name = 1; - - // A description provided by the user for the job. Its max length is 1024 - // bytes when Unicode-encoded. - string description = 2; - - // The ID of the Google Cloud project that owns the job. - string project_id = 3; - - // Transfer specification. - TransferSpec transfer_spec = 4; - - // Notification configuration. This is not supported for transfers involving - // PosixFilesystem. - NotificationConfig notification_config = 11; - - // Logging configuration. - LoggingConfig logging_config = 14; - - // Specifies schedule for the transfer job. - // This is an optional field. When the field is not set, the job never - // executes a transfer, unless you invoke RunTransferJob or update the job to - // have a non-empty schedule. - Schedule schedule = 5; - - // Status of the job. This value MUST be specified for - // `CreateTransferJobRequests`. - // - // **Note:** The effect of the new job status takes place during a subsequent - // job run. For example, if you change the job status from - // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED] to [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], and an operation - // spawned by the transfer is running, the status change would not affect the - // current operation. - Status status = 6; - - // Output only. The time that the transfer job was created. - google.protobuf.Timestamp creation_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time that the transfer job was last modified. - google.protobuf.Timestamp last_modification_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time that the transfer job was deleted. - google.protobuf.Timestamp deletion_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The name of the most recently started TransferOperation of this JobConfig. - // Present if a TransferOperation has been created for this JobConfig. - string latest_operation_name = 12; -} - -// An entry describing an error that has occurred. -message ErrorLogEntry { - // Required. A URL that refers to the target (a data source, a data sink, - // or an object) with which the error is associated. - string url = 1 [(google.api.field_behavior) = REQUIRED]; - - // A list of messages that carry the error details. - repeated string error_details = 3; -} - -// A summary of errors by error code, plus a count and sample error log -// entries. -message ErrorSummary { - // Required. - google.rpc.Code error_code = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Count of this type of error. - int64 error_count = 2 [(google.api.field_behavior) = REQUIRED]; - - // Error samples. - // - // At most 5 error log entries are recorded for a given - // error code for a single transfer operation. - repeated ErrorLogEntry error_log_entries = 3; -} - -// A collection of counters that report the progress of a transfer operation. -message TransferCounters { - // Objects found in the data source that are scheduled to be transferred, - // excluding any that are filtered based on object conditions or skipped due - // to sync. - int64 objects_found_from_source = 1; - - // Bytes found in the data source that are scheduled to be transferred, - // excluding any that are filtered based on object conditions or skipped due - // to sync. - int64 bytes_found_from_source = 2; - - // Objects found only in the data sink that are scheduled to be deleted. - int64 objects_found_only_from_sink = 3; - - // Bytes found only in the data sink that are scheduled to be deleted. - int64 bytes_found_only_from_sink = 4; - - // Objects in the data source that are not transferred because they already - // exist in the data sink. - int64 objects_from_source_skipped_by_sync = 5; - - // Bytes in the data source that are not transferred because they already - // exist in the data sink. - int64 bytes_from_source_skipped_by_sync = 6; - - // Objects that are copied to the data sink. - int64 objects_copied_to_sink = 7; - - // Bytes that are copied to the data sink. - int64 bytes_copied_to_sink = 8; - - // Objects that are deleted from the data source. - int64 objects_deleted_from_source = 9; - - // Bytes that are deleted from the data source. - int64 bytes_deleted_from_source = 10; - - // Objects that are deleted from the data sink. - int64 objects_deleted_from_sink = 11; - - // Bytes that are deleted from the data sink. - int64 bytes_deleted_from_sink = 12; - - // Objects in the data source that failed to be transferred or that failed - // to be deleted after being transferred. - int64 objects_from_source_failed = 13; - - // Bytes in the data source that failed to be transferred or that failed to - // be deleted after being transferred. - int64 bytes_from_source_failed = 14; - - // Objects that failed to be deleted from the data sink. - int64 objects_failed_to_delete_from_sink = 15; - - // Bytes that failed to be deleted from the data sink. - int64 bytes_failed_to_delete_from_sink = 16; - - // For transfers involving PosixFilesystem only. - // - // Number of directories found while listing. For example, if the root - // directory of the transfer is `base/` and there are two other directories, - // `a/` and `b/` under this directory, the count after listing `base/`, - // `base/a/` and `base/b/` is 3. - int64 directories_found_from_source = 17; - - // For transfers involving PosixFilesystem only. - // - // Number of listing failures for each directory found at the source. - // Potential failures when listing a directory include permission failure or - // block failure. If listing a directory fails, no files in the directory are - // transferred. - int64 directories_failed_to_list_from_source = 18; - - // For transfers involving PosixFilesystem only. - // - // Number of successful listings for each directory found at the source. - int64 directories_successfully_listed_from_source = 19; - - // Number of successfully cleaned up intermediate objects. - int64 intermediate_objects_cleaned_up = 22; - - // Number of intermediate objects failed cleaned up. - int64 intermediate_objects_failed_cleaned_up = 23; -} - -// Specification to configure notifications published to Pub/Sub. -// Notifications are published to the customer-provided topic using the -// following `PubsubMessage.attributes`: -// -// * `"eventType"`: one of the [EventType][google.storagetransfer.v1.NotificationConfig.EventType] values -// * `"payloadFormat"`: one of the [PayloadFormat][google.storagetransfer.v1.NotificationConfig.PayloadFormat] values -// * `"projectId"`: the [project_id][google.storagetransfer.v1.TransferOperation.project_id] of the -// `TransferOperation` -// * `"transferJobName"`: the -// [transfer_job_name][google.storagetransfer.v1.TransferOperation.transfer_job_name] of the -// `TransferOperation` -// * `"transferOperationName"`: the [name][google.storagetransfer.v1.TransferOperation.name] of the -// `TransferOperation` -// -// The `PubsubMessage.data` contains a [TransferOperation][google.storagetransfer.v1.TransferOperation] resource -// formatted according to the specified `PayloadFormat`. -message NotificationConfig { - // Enum for specifying event types for which notifications are to be - // published. - // - // Additional event types may be added in the future. Clients should either - // safely ignore unrecognized event types or explicitly specify which event - // types they are prepared to accept. - enum EventType { - // Illegal value, to avoid allowing a default. - EVENT_TYPE_UNSPECIFIED = 0; - - // `TransferOperation` completed with status - // [SUCCESS][google.storagetransfer.v1.TransferOperation.Status.SUCCESS]. - TRANSFER_OPERATION_SUCCESS = 1; - - // `TransferOperation` completed with status - // [FAILED][google.storagetransfer.v1.TransferOperation.Status.FAILED]. - TRANSFER_OPERATION_FAILED = 2; - - // `TransferOperation` completed with status - // [ABORTED][google.storagetransfer.v1.TransferOperation.Status.ABORTED]. - TRANSFER_OPERATION_ABORTED = 3; - } - - // Enum for specifying the format of a notification message's payload. - enum PayloadFormat { - // Illegal value, to avoid allowing a default. - PAYLOAD_FORMAT_UNSPECIFIED = 0; - - // No payload is included with the notification. - NONE = 1; - - // `TransferOperation` is [formatted as a JSON - // response](https://developers.google.com/protocol-buffers/docs/proto3#json), - // in application/json. - JSON = 2; - } - - // Required. The `Topic.name` of the Pub/Sub topic to which to publish - // notifications. Must be of the format: `projects/{project}/topics/{topic}`. - // Not matching this format results in an - // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error. - string pubsub_topic = 1 [(google.api.field_behavior) = REQUIRED]; - - // Event types for which a notification is desired. If empty, send - // notifications for all event types. - repeated EventType event_types = 2; - - // Required. The desired format of the notification message payloads. - PayloadFormat payload_format = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies the logging behavior for transfer operations. -// -// For cloud-to-cloud transfers, logs are sent to Cloud Logging. See -// [Read transfer -// logs](https://cloud.google.com/storage-transfer/docs/read-transfer-logs) for -// details. -// -// For transfers to or from a POSIX file system, logs are stored in the -// Cloud Storage bucket that is the source or sink of the transfer. -// See [Managing Transfer for on-premises jobs] -// (https://cloud.google.com/storage-transfer/docs/managing-on-prem-jobs#viewing-logs) -// for details. -message LoggingConfig { - // Loggable actions. - enum LoggableAction { - // Default value. This value is unused. - LOGGABLE_ACTION_UNSPECIFIED = 0; - - // Listing objects in a bucket. - FIND = 1; - - // Deleting objects at the source or the destination. - DELETE = 2; - - // Copying objects to Google Cloud Storage. - COPY = 3; - } - - // Loggable action states. - enum LoggableActionState { - // Default value. This value is unused. - LOGGABLE_ACTION_STATE_UNSPECIFIED = 0; - - // `LoggableAction` completed successfully. `SUCCEEDED` actions are - // logged as [INFO][google.logging.type.LogSeverity.INFO]. - SUCCEEDED = 1; - - // `LoggableAction` terminated in an error state. `FAILED` actions are - // logged as [ERROR][google.logging.type.LogSeverity.ERROR]. - FAILED = 2; - } - - // Specifies the actions to be logged. If empty, no logs are generated. - // Not supported for transfers with PosixFilesystem data sources; use - // [enable_onprem_gcs_transfer_logs][google.storagetransfer.v1.LoggingConfig.enable_onprem_gcs_transfer_logs] instead. - repeated LoggableAction log_actions = 1; - - // States in which `log_actions` are logged. If empty, no logs are generated. - // Not supported for transfers with PosixFilesystem data sources; use - // [enable_onprem_gcs_transfer_logs][google.storagetransfer.v1.LoggingConfig.enable_onprem_gcs_transfer_logs] instead. - repeated LoggableActionState log_action_states = 2; - - // For transfers with a PosixFilesystem source, this option enables the Cloud - // Storage transfer logs for this transfer. - bool enable_onprem_gcs_transfer_logs = 3; -} - -// A description of the execution of a transfer. -message TransferOperation { - // The status of a TransferOperation. - enum Status { - // Zero is an illegal value. - STATUS_UNSPECIFIED = 0; - - // In progress. - IN_PROGRESS = 1; - - // Paused. - PAUSED = 2; - - // Completed successfully. - SUCCESS = 3; - - // Terminated due to an unrecoverable failure. - FAILED = 4; - - // Aborted by the user. - ABORTED = 5; - - // Temporarily delayed by the system. No user action is required. - QUEUED = 6; - } - - // A globally unique ID assigned by the system. - string name = 1; - - // The ID of the Google Cloud project that owns the operation. - string project_id = 2; - - // Transfer specification. - TransferSpec transfer_spec = 3; - - // Notification configuration. - NotificationConfig notification_config = 10; - - // Start time of this transfer execution. - google.protobuf.Timestamp start_time = 4; - - // End time of this transfer execution. - google.protobuf.Timestamp end_time = 5; - - // Status of the transfer operation. - Status status = 6; - - // Information about the progress of the transfer operation. - TransferCounters counters = 7; - - // Summarizes errors encountered with sample error log entries. - repeated ErrorSummary error_breakdowns = 8; - - // The name of the transfer job that triggers this transfer operation. - string transfer_job_name = 9; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json deleted file mode 100644 index 5dd0a10..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json +++ /dev/null @@ -1,631 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-storagetransfer", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.storagetransfer.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async", - "title": "StorageTransferService getGoogleServiceAccount Sample", - "origin": "API_DEFINITION", - "description": " Returns the Google service account that is used by Storage Transfer Service to access buckets in the project where transfers run or in other projects. Each Google service account is associated with one Google Cloud project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only be used by Storage Transfer Service.", - "canonical": true, - "file": "storage_transfer_service.get_google_service_account.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGoogleServiceAccount", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetGoogleServiceAccount", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.GoogleServiceAccount", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "GetGoogleServiceAccount", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetGoogleServiceAccount", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async", - "title": "StorageTransferService createTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Creates a transfer job that runs periodically.", - "canonical": true, - "file": "storage_transfer_service.create_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.CreateTransferJob", - "async": true, - "parameters": [ - { - "name": "transfer_job", - "type": ".google.storagetransfer.v1.TransferJob" - } - ], - "resultType": ".google.storagetransfer.v1.TransferJob", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "CreateTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.CreateTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async", - "title": "StorageTransferService updateTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running already. **Note:** The job's [status][google.storagetransfer.v1.TransferJob.status] field can be modified using this RPC (for example, to set a job's status to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED], [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], or [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]).", - "canonical": true, - "file": "storage_transfer_service.update_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateTransferJob", - "async": true, - "parameters": [ - { - "name": "job_name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "transfer_job", - "type": ".google.storagetransfer.v1.TransferJob" - }, - { - "name": "update_transfer_job_field_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.storagetransfer.v1.TransferJob", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "UpdateTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async", - "title": "StorageTransferService getTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Gets a transfer job.", - "canonical": true, - "file": "storage_transfer_service.get_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetTransferJob", - "async": true, - "parameters": [ - { - "name": "job_name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.TransferJob", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "GetTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async", - "title": "StorageTransferService listTransferJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists transfer jobs.", - "canonical": true, - "file": "storage_transfer_service.list_transfer_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTransferJobs", - "fullName": "google.storagetransfer.v1.StorageTransferService.ListTransferJobs", - "async": true, - "parameters": [ - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.ListTransferJobsResponse", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "ListTransferJobs", - "fullName": "google.storagetransfer.v1.StorageTransferService.ListTransferJobs", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async", - "title": "StorageTransferService pauseTransferOperation Sample", - "origin": "API_DEFINITION", - "description": " Pauses a transfer operation.", - "canonical": true, - "file": "storage_transfer_service.pause_transfer_operation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PauseTransferOperation", - "fullName": "google.storagetransfer.v1.StorageTransferService.PauseTransferOperation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "PauseTransferOperation", - "fullName": "google.storagetransfer.v1.StorageTransferService.PauseTransferOperation", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async", - "title": "StorageTransferService resumeTransferOperation Sample", - "origin": "API_DEFINITION", - "description": " Resumes a transfer operation that is paused.", - "canonical": true, - "file": "storage_transfer_service.resume_transfer_operation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResumeTransferOperation", - "fullName": "google.storagetransfer.v1.StorageTransferService.ResumeTransferOperation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "ResumeTransferOperation", - "fullName": "google.storagetransfer.v1.StorageTransferService.ResumeTransferOperation", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async", - "title": "StorageTransferService runTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Attempts to start a new TransferOperation for the current TransferJob. A TransferJob has a maximum of one active TransferOperation. If this method is called while a TransferOperation is active, an error will be returned.", - "canonical": true, - "file": "storage_transfer_service.run_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.RunTransferJob", - "async": true, - "parameters": [ - { - "name": "job_name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "RunTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.RunTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async", - "title": "StorageTransferService deleteTransferJob Sample", - "origin": "API_DEFINITION", - "description": " Deletes a transfer job. Deleting a transfer job sets its status to [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED].", - "canonical": true, - "file": "storage_transfer_service.delete_transfer_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", - "async": true, - "parameters": [ - { - "name": "job_name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "DeleteTransferJob", - "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteTransferJob", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async", - "title": "StorageTransferService createAgentPool Sample", - "origin": "API_DEFINITION", - "description": " Creates an agent pool resource.", - "canonical": true, - "file": "storage_transfer_service.create_agent_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.CreateAgentPool", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "agent_pool", - "type": ".google.storagetransfer.v1.AgentPool" - }, - { - "name": "agent_pool_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.AgentPool", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "CreateAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.CreateAgentPool", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async", - "title": "StorageTransferService updateAgentPool Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing agent pool resource.", - "canonical": true, - "file": "storage_transfer_service.update_agent_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateAgentPool", - "async": true, - "parameters": [ - { - "name": "agent_pool", - "type": ".google.storagetransfer.v1.AgentPool" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.storagetransfer.v1.AgentPool", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "UpdateAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.UpdateAgentPool", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async", - "title": "StorageTransferService getAgentPool Sample", - "origin": "API_DEFINITION", - "description": " Gets an agent pool.", - "canonical": true, - "file": "storage_transfer_service.get_agent_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetAgentPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.AgentPool", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "GetAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.GetAgentPool", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async", - "title": "StorageTransferService listAgentPools Sample", - "origin": "API_DEFINITION", - "description": " Lists agent pools.", - "canonical": true, - "file": "storage_transfer_service.list_agent_pools.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAgentPools", - "fullName": "google.storagetransfer.v1.StorageTransferService.ListAgentPools", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.storagetransfer.v1.ListAgentPoolsResponse", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "ListAgentPools", - "fullName": "google.storagetransfer.v1.StorageTransferService.ListAgentPools", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - }, - { - "regionTag": "storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async", - "title": "StorageTransferService deleteAgentPool Sample", - "origin": "API_DEFINITION", - "description": " Deletes an agent pool.", - "canonical": true, - "file": "storage_transfer_service.delete_agent_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteAgentPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "StorageTransferServiceClient", - "fullName": "google.storagetransfer.v1.StorageTransferServiceClient" - }, - "method": { - "shortName": "DeleteAgentPool", - "fullName": "google.storagetransfer.v1.StorageTransferService.DeleteAgentPool", - "service": { - "shortName": "StorageTransferService", - "fullName": "google.storagetransfer.v1.StorageTransferService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.js deleted file mode 100644 index ed5464a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_agent_pool.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(projectId, agentPool, agentPoolId) { - // [START storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Google Cloud project that owns the - * agent pool. - */ - // const projectId = 'abc123' - /** - * Required. The agent pool to create. - */ - // const agentPool = {} - /** - * Required. The ID of the agent pool to create. - * The `agent_pool_id` must meet the following requirements: - * * Length of 128 characters or less. - * * Not start with the string `goog`. - * * Start with a lowercase ASCII character, followed by: - * * Zero or more: lowercase Latin alphabet characters, numerals, - * hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). - * * One or more numerals or lowercase ASCII characters. - * As expressed by the regular expression: - * `^(?!goog)a-z(a-z0-9-._~*a-z0-9)?$`. - */ - // const agentPoolId = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callCreateAgentPool() { - // Construct request - const request = { - projectId, - agentPool, - agentPoolId, - }; - - // Run request - const response = await storagetransferClient.createAgentPool(request); - console.log(response); - } - - callCreateAgentPool(); - // [END storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_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/storage_transfer_service.create_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js deleted file mode 100644 index 5daf776..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.create_transfer_job.js +++ /dev/null @@ -1,61 +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(transferJob) { - // [START storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The job to create. - */ - // const transferJob = {} - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callCreateTransferJob() { - // Construct request - const request = { - transferJob, - }; - - // Run request - const response = await storagetransferClient.createTransferJob(request); - console.log(response); - } - - callCreateTransferJob(); - // [END storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_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/storage_transfer_service.delete_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js deleted file mode 100644 index fe2d324..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_agent_pool.js +++ /dev/null @@ -1,61 +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 storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent pool to delete. - */ - // const name = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callDeleteAgentPool() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await storagetransferClient.deleteAgentPool(request); - console.log(response); - } - - callDeleteAgentPool(); - // [END storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_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/storage_transfer_service.delete_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.js deleted file mode 100644 index c70c251..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.delete_transfer_job.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(jobName, projectId) { - // [START storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The job to delete. - */ - // const jobName = 'abc123' - /** - * Required. The ID of the Google Cloud project that owns the - * job. - */ - // const projectId = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callDeleteTransferJob() { - // Construct request - const request = { - jobName, - projectId, - }; - - // Run request - const response = await storagetransferClient.deleteTransferJob(request); - console.log(response); - } - - callDeleteTransferJob(); - // [END storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_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/storage_transfer_service.get_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js deleted file mode 100644 index 4b30734..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_agent_pool.js +++ /dev/null @@ -1,61 +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 storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent pool to get. - */ - // const name = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callGetAgentPool() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await storagetransferClient.getAgentPool(request); - console.log(response); - } - - callGetAgentPool(); - // [END storagetransfer_v1_generated_StorageTransferService_GetAgentPool_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/storage_transfer_service.get_google_service_account.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js deleted file mode 100644 index 1b8411e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_google_service_account.js +++ /dev/null @@ -1,62 +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(projectId) { - // [START storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Google Cloud project that the Google service - * account is associated with. - */ - // const projectId = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callGetGoogleServiceAccount() { - // Construct request - const request = { - projectId, - }; - - // Run request - const response = await storagetransferClient.getGoogleServiceAccount(request); - console.log(response); - } - - callGetGoogleServiceAccount(); - // [END storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_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/storage_transfer_service.get_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.js deleted file mode 100644 index c7cbd13..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.get_transfer_job.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(jobName, projectId) { - // [START storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The job to get. - */ - // const jobName = 'abc123' - /** - * Required. The ID of the Google Cloud project that owns the - * job. - */ - // const projectId = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callGetTransferJob() { - // Construct request - const request = { - jobName, - projectId, - }; - - // Run request - const response = await storagetransferClient.getTransferJob(request); - console.log(response); - } - - callGetTransferJob(); - // [END storagetransfer_v1_generated_StorageTransferService_GetTransferJob_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/storage_transfer_service.list_agent_pools.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js deleted file mode 100644 index 636a133..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_agent_pools.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId) { - // [START storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Google Cloud project that owns the job. - */ - // const projectId = 'abc123' - /** - * An optional list of query parameters specified as JSON text in the - * form of: - * `{"agentPoolNames":"agentpool1","agentpool2",... }` - * Since `agentPoolNames` support multiple values, its values must be - * specified with array notation. When the filter is either empty or not - * provided, the list returns all agent pools for the project. - */ - // const filter = 'abc123' - /** - * The list page size. The max allowed value is `256`. - */ - // const pageSize = 1234 - /** - * The list page token. - */ - // const pageToken = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callListAgentPools() { - // Construct request - const request = { - projectId, - }; - - // Run request - const iterable = await storagetransferClient.listAgentPoolsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAgentPools(); - // [END storagetransfer_v1_generated_StorageTransferService_ListAgentPools_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/storage_transfer_service.list_transfer_jobs.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js deleted file mode 100644 index fa1d170..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.list_transfer_jobs.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(filter) { - // [START storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":"jobid1","jobid2",..., - * "jobStatuses":"status1","status2",... }` - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * ENABLED google.storagetransfer.v1.TransferJob.Status.ENABLED, - * DISABLED google.storagetransfer.v1.TransferJob.Status.DISABLED, and - * DELETED google.storagetransfer.v1.TransferJob.Status.DELETED. - */ - // const filter = 'abc123' - /** - * The list page size. The max allowed value is 256. - */ - // const pageSize = 1234 - /** - * The list page token. - */ - // const pageToken = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callListTransferJobs() { - // Construct request - const request = { - filter, - }; - - // Run request - const iterable = await storagetransferClient.listTransferJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTransferJobs(); - // [END storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_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/storage_transfer_service.pause_transfer_operation.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js deleted file mode 100644 index 9a11fd3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js +++ /dev/null @@ -1,61 +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 storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the transfer operation. - */ - // const name = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callPauseTransferOperation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await storagetransferClient.pauseTransferOperation(request); - console.log(response); - } - - callPauseTransferOperation(); - // [END storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_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/storage_transfer_service.resume_transfer_operation.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js deleted file mode 100644 index 565ac82..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js +++ /dev/null @@ -1,61 +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 storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the transfer operation. - */ - // const name = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callResumeTransferOperation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await storagetransferClient.resumeTransferOperation(request); - console.log(response); - } - - callResumeTransferOperation(); - // [END storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_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/storage_transfer_service.run_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js deleted file mode 100644 index ce83387..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.run_transfer_job.js +++ /dev/null @@ -1,68 +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(jobName, projectId) { - // [START storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the transfer job. - */ - // const jobName = 'abc123' - /** - * Required. The ID of the Google Cloud project that owns the transfer - * job. - */ - // const projectId = 'abc123' - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callRunTransferJob() { - // Construct request - const request = { - jobName, - projectId, - }; - - // Run request - const [operation] = await storagetransferClient.runTransferJob(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunTransferJob(); - // [END storagetransfer_v1_generated_StorageTransferService_RunTransferJob_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/storage_transfer_service.update_agent_pool.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.js deleted file mode 100644 index b2cf855..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_agent_pool.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(agentPool) { - // [START storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent pool to update. `agent_pool` is expected to specify following - * fields: - * * name google.storagetransfer.v1.AgentPool.name - * * display_name google.storagetransfer.v1.AgentPool.display_name - * * bandwidth_limit google.storagetransfer.v1.AgentPool.bandwidth_limit - * An `UpdateAgentPoolRequest` with any other fields is rejected - * with the error INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. - */ - // const agentPool = {} - /** - * The field mask - * (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) - * of the fields in `agentPool` to update in this request. - * The following `agentPool` fields can be updated: - * * display_name google.storagetransfer.v1.AgentPool.display_name - * * bandwidth_limit google.storagetransfer.v1.AgentPool.bandwidth_limit - */ - // const updateMask = {} - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callUpdateAgentPool() { - // Construct request - const request = { - agentPool, - }; - - // Run request - const response = await storagetransferClient.updateAgentPool(request); - console.log(response); - } - - callUpdateAgentPool(); - // [END storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_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/storage_transfer_service.update_transfer_job.js b/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js deleted file mode 100644 index 7961e98..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/storage_transfer_service.update_transfer_job.js +++ /dev/null @@ -1,94 +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(jobName, projectId, transferJob) { - // [START storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of job to update. - */ - // const jobName = 'abc123' - /** - * Required. The ID of the Google Cloud project that owns the - * job. - */ - // const projectId = 'abc123' - /** - * Required. The job to update. `transferJob` is expected to specify one or more of - * five fields: description google.storagetransfer.v1.TransferJob.description, - * transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec, - * notification_config google.storagetransfer.v1.TransferJob.notification_config, - * logging_config google.storagetransfer.v1.TransferJob.logging_config, and - * status google.storagetransfer.v1.TransferJob.status. An `UpdateTransferJobRequest` that specifies - * other fields are rejected with the error - * INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. Updating a job status - * to DELETED google.storagetransfer.v1.TransferJob.Status.DELETED requires - * `storagetransfer.jobs.delete` permission. - */ - // const transferJob = {} - /** - * The field mask of the fields in `transferJob` that are to be updated in - * this request. Fields in `transferJob` that can be updated are: - * description google.storagetransfer.v1.TransferJob.description, - * transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec, - * notification_config google.storagetransfer.v1.TransferJob.notification_config, - * logging_config google.storagetransfer.v1.TransferJob.logging_config, and - * status google.storagetransfer.v1.TransferJob.status. To update the `transfer_spec` of the job, a - * complete transfer specification must be provided. An incomplete - * specification missing any required fields is rejected with the error - * INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. - */ - // const updateTransferJobFieldMask = {} - - // Imports the Storagetransfer library - const {StorageTransferServiceClient} = require('@google-cloud/storage-transfer').v1; - - // Instantiates a client - const storagetransferClient = new StorageTransferServiceClient(); - - async function callUpdateTransferJob() { - // Construct request - const request = { - jobName, - projectId, - transferJob, - }; - - // Run request - const response = await storagetransferClient.updateTransferJob(request); - console.log(response); - } - - callUpdateTransferJob(); - // [END storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index b2ff704..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 StorageTransferServiceClient = v1.StorageTransferServiceClient; -type StorageTransferServiceClient = v1.StorageTransferServiceClient; -export {v1, StorageTransferServiceClient}; -export default {v1, StorageTransferServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 4155aeb..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.storagetransfer.v1", - "libraryPackage": "@google-cloud/storage-transfer", - "services": { - "StorageTransferService": { - "clients": { - "grpc": { - "libraryClient": "StorageTransferServiceClient", - "rpcs": { - "GetGoogleServiceAccount": { - "methods": [ - "getGoogleServiceAccount" - ] - }, - "CreateTransferJob": { - "methods": [ - "createTransferJob" - ] - }, - "UpdateTransferJob": { - "methods": [ - "updateTransferJob" - ] - }, - "GetTransferJob": { - "methods": [ - "getTransferJob" - ] - }, - "PauseTransferOperation": { - "methods": [ - "pauseTransferOperation" - ] - }, - "ResumeTransferOperation": { - "methods": [ - "resumeTransferOperation" - ] - }, - "DeleteTransferJob": { - "methods": [ - "deleteTransferJob" - ] - }, - "CreateAgentPool": { - "methods": [ - "createAgentPool" - ] - }, - "UpdateAgentPool": { - "methods": [ - "updateAgentPool" - ] - }, - "GetAgentPool": { - "methods": [ - "getAgentPool" - ] - }, - "DeleteAgentPool": { - "methods": [ - "deleteAgentPool" - ] - }, - "RunTransferJob": { - "methods": [ - "runTransferJob" - ] - }, - "ListTransferJobs": { - "methods": [ - "listTransferJobs", - "listTransferJobsStream", - "listTransferJobsAsync" - ] - }, - "ListAgentPools": { - "methods": [ - "listAgentPools", - "listAgentPoolsStream", - "listAgentPoolsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "StorageTransferServiceClient", - "rpcs": { - "GetGoogleServiceAccount": { - "methods": [ - "getGoogleServiceAccount" - ] - }, - "CreateTransferJob": { - "methods": [ - "createTransferJob" - ] - }, - "UpdateTransferJob": { - "methods": [ - "updateTransferJob" - ] - }, - "GetTransferJob": { - "methods": [ - "getTransferJob" - ] - }, - "PauseTransferOperation": { - "methods": [ - "pauseTransferOperation" - ] - }, - "ResumeTransferOperation": { - "methods": [ - "resumeTransferOperation" - ] - }, - "DeleteTransferJob": { - "methods": [ - "deleteTransferJob" - ] - }, - "CreateAgentPool": { - "methods": [ - "createAgentPool" - ] - }, - "UpdateAgentPool": { - "methods": [ - "updateAgentPool" - ] - }, - "GetAgentPool": { - "methods": [ - "getAgentPool" - ] - }, - "DeleteAgentPool": { - "methods": [ - "deleteAgentPool" - ] - }, - "RunTransferJob": { - "methods": [ - "runTransferJob" - ] - }, - "ListTransferJobs": { - "methods": [ - "listTransferJobs", - "listTransferJobsStream", - "listTransferJobsAsync" - ] - }, - "ListAgentPools": { - "methods": [ - "listAgentPools", - "listAgentPoolsStream", - "listAgentPoolsAsync" - ] - } - } - } - } - } - } -} 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 f0a69d4..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 {StorageTransferServiceClient} from './storage_transfer_service_client'; diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts b/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts deleted file mode 100644 index 159d3ff..0000000 --- a/owl-bot-staging/v1/src/v1/storage_transfer_service_client.ts +++ /dev/null @@ -1,1916 +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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/storage_transfer_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './storage_transfer_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Storage Transfer Service and its protos. - * Transfers data between between Google Cloud Storage buckets or from a data - * source external to Google to a Cloud Storage bucket. - * @class - * @memberof v1 - */ -export class StorageTransferServiceClient { - 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; - storageTransferServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of StorageTransferServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new StorageTransferServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof StorageTransferServiceClient; - 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - agentPoolsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_id}/agentPools/{agent_pool_id}' - ), - }; - - // 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 = { - listTransferJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'transferJobs'), - listAgentPools: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'agentPools') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=transferOperations/**}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=transferOperations/**}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=transferOperations}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const runTransferJobResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const runTransferJobMetadata = protoFilesRoot.lookup( - '.google.storagetransfer.v1.TransferOperation') as gax.protobuf.Type; - - this.descriptors.longrunning = { - runTransferJob: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runTransferJobResponse.decode.bind(runTransferJobResponse), - runTransferJobMetadata.decode.bind(runTransferJobMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.storagetransfer.v1.StorageTransferService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.storageTransferServiceStub) { - return this.storageTransferServiceStub; - } - - // Put together the "service stub" for - // google.storagetransfer.v1.StorageTransferService. - this.storageTransferServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.storagetransfer.v1.StorageTransferService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.storagetransfer.v1.StorageTransferService, - 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 storageTransferServiceStubMethods = - ['getGoogleServiceAccount', 'createTransferJob', 'updateTransferJob', 'getTransferJob', 'listTransferJobs', 'pauseTransferOperation', 'resumeTransferOperation', 'runTransferJob', 'deleteTransferJob', 'createAgentPool', 'updateAgentPool', 'getAgentPool', 'listAgentPools', 'deleteAgentPool']; - for (const methodName of storageTransferServiceStubMethods) { - const callPromise = this.storageTransferServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.storageTransferServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'storagetransfer.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 'storagetransfer.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 -- - // ------------------- -/** - * Returns the Google service account that is used by Storage Transfer - * Service to access buckets in the project where transfers - * run or in other projects. Each Google service account is associated - * with one Google Cloud project. Users - * should add this service account to the Google Cloud Storage bucket - * ACLs to grant access to Storage Transfer Service. This service - * account is created and owned by Storage Transfer Service and can - * only be used by Storage Transfer Service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that the Google service - * account is associated with. - * @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 [GoogleServiceAccount]{@link google.storagetransfer.v1.GoogleServiceAccount}. - * 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/storage_transfer_service.get_google_service_account.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async - */ - getGoogleServiceAccount( - request?: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|undefined, {}|undefined - ]>; - getGoogleServiceAccount( - request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, - {}|null|undefined>): void; - getGoogleServiceAccount( - request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, - callback: Callback< - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, - {}|null|undefined>): void; - getGoogleServiceAccount( - request?: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.IGoogleServiceAccount, - protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getGoogleServiceAccount(request, options, callback); - } -/** - * Creates a transfer job that runs periodically. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.storagetransfer.v1.TransferJob} request.transferJob - * Required. The job to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TransferJob]{@link google.storagetransfer.v1.TransferJob}. - * 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/storage_transfer_service.create_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async - */ - createTransferJob( - request?: protos.google.storagetransfer.v1.ICreateTransferJobRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|undefined, {}|undefined - ]>; - createTransferJob( - request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, - {}|null|undefined>): void; - createTransferJob( - request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, - {}|null|undefined>): void; - createTransferJob( - request?: protos.google.storagetransfer.v1.ICreateTransferJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.ICreateTransferJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.createTransferJob(request, options, callback); - } -/** - * Updates a transfer job. Updating a job's transfer spec does not affect - * transfer operations that are running already. - * - * **Note:** The job's {@link google.storagetransfer.v1.TransferJob.status|status} field can be modified - * using this RPC (for example, to set a job's status to - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}, - * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, or - * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.jobName - * Required. The name of job to update. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the - * job. - * @param {google.storagetransfer.v1.TransferJob} request.transferJob - * Required. The job to update. `transferJob` is expected to specify one or more of - * five fields: {@link google.storagetransfer.v1.TransferJob.description|description}, - * {@link google.storagetransfer.v1.TransferJob.transfer_spec|transfer_spec}, - * {@link google.storagetransfer.v1.TransferJob.notification_config|notification_config}, - * {@link google.storagetransfer.v1.TransferJob.logging_config|logging_config}, and - * {@link google.storagetransfer.v1.TransferJob.status|status}. An `UpdateTransferJobRequest` that specifies - * other fields are rejected with the error - * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. Updating a job status - * to {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED} requires - * `storagetransfer.jobs.delete` permission. - * @param {google.protobuf.FieldMask} request.updateTransferJobFieldMask - * The field mask of the fields in `transferJob` that are to be updated in - * this request. Fields in `transferJob` that can be updated are: - * {@link google.storagetransfer.v1.TransferJob.description|description}, - * {@link google.storagetransfer.v1.TransferJob.transfer_spec|transfer_spec}, - * {@link google.storagetransfer.v1.TransferJob.notification_config|notification_config}, - * {@link google.storagetransfer.v1.TransferJob.logging_config|logging_config}, and - * {@link google.storagetransfer.v1.TransferJob.status|status}. To update the `transfer_spec` of the job, a - * complete transfer specification must be provided. An incomplete - * specification missing any required fields is rejected with the error - * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. - * @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 [TransferJob]{@link google.storagetransfer.v1.TransferJob}. - * 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/storage_transfer_service.update_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async - */ - updateTransferJob( - request?: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|undefined, {}|undefined - ]>; - updateTransferJob( - request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, - {}|null|undefined>): void; - updateTransferJob( - request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, - {}|null|undefined>): void; - updateTransferJob( - request?: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IUpdateTransferJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'job_name': request.jobName ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateTransferJob(request, options, callback); - } -/** - * Gets a transfer job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.jobName - * Required. The job to get. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the - * job. - * @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 [TransferJob]{@link google.storagetransfer.v1.TransferJob}. - * 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/storage_transfer_service.get_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async - */ - getTransferJob( - request?: protos.google.storagetransfer.v1.IGetTransferJobRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|undefined, {}|undefined - ]>; - getTransferJob( - request: protos.google.storagetransfer.v1.IGetTransferJobRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, - {}|null|undefined>): void; - getTransferJob( - request: protos.google.storagetransfer.v1.IGetTransferJobRequest, - callback: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, - {}|null|undefined>): void; - getTransferJob( - request?: protos.google.storagetransfer.v1.IGetTransferJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob, - protos.google.storagetransfer.v1.IGetTransferJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'job_name': request.jobName ?? '', - }); - this.initialize(); - return this.innerApiCalls.getTransferJob(request, options, callback); - } -/** - * Pauses a transfer operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the transfer operation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/storage_transfer_service.pause_transfer_operation.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async - */ - pauseTransferOperation( - request?: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|undefined, {}|undefined - ]>; - pauseTransferOperation( - request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, - {}|null|undefined>): void; - pauseTransferOperation( - request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, - {}|null|undefined>): void; - pauseTransferOperation( - request?: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IPauseTransferOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.pauseTransferOperation(request, options, callback); - } -/** - * Resumes a transfer operation that is paused. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the transfer operation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/storage_transfer_service.resume_transfer_operation.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async - */ - resumeTransferOperation( - request?: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|undefined, {}|undefined - ]>; - resumeTransferOperation( - request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, - {}|null|undefined>): void; - resumeTransferOperation( - request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, - {}|null|undefined>): void; - resumeTransferOperation( - request?: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IResumeTransferOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.resumeTransferOperation(request, options, callback); - } -/** - * Deletes a transfer job. Deleting a transfer job sets its status to - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.jobName - * Required. The job to delete. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the - * job. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/storage_transfer_service.delete_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_DeleteTransferJob_async - */ - deleteTransferJob( - request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|undefined, {}|undefined - ]>; - deleteTransferJob( - request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, - {}|null|undefined>): void; - deleteTransferJob( - request: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, - {}|null|undefined>): void; - deleteTransferJob( - request?: protos.google.storagetransfer.v1.IDeleteTransferJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteTransferJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'job_name': request.jobName ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteTransferJob(request, options, callback); - } -/** - * Creates an agent pool resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the - * agent pool. - * @param {google.storagetransfer.v1.AgentPool} request.agentPool - * Required. The agent pool to create. - * @param {string} request.agentPoolId - * Required. The ID of the agent pool to create. - * - * The `agent_pool_id` must meet the following requirements: - * - * * Length of 128 characters or less. - * * Not start with the string `goog`. - * * Start with a lowercase ASCII character, followed by: - * * Zero or more: lowercase Latin alphabet characters, numerals, - * hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`). - * * One or more numerals or lowercase ASCII characters. - * - * As expressed by the regular expression: - * `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`. - * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. - * 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/storage_transfer_service.create_agent_pool.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async - */ - createAgentPool( - request?: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|undefined, {}|undefined - ]>; - createAgentPool( - request: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - createAgentPool( - request: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - createAgentPool( - request?: protos.google.storagetransfer.v1.ICreateAgentPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.ICreateAgentPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - }); - this.initialize(); - return this.innerApiCalls.createAgentPool(request, options, callback); - } -/** - * Updates an existing agent pool resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.storagetransfer.v1.AgentPool} request.agentPool - * Required. The agent pool to update. `agent_pool` is expected to specify following - * fields: - * - * * {@link google.storagetransfer.v1.AgentPool.name|name} - * - * * {@link google.storagetransfer.v1.AgentPool.display_name|display_name} - * - * * {@link google.storagetransfer.v1.AgentPool.bandwidth_limit|bandwidth_limit} - * An `UpdateAgentPoolRequest` with any other fields is rejected - * with the error {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}. - * @param {google.protobuf.FieldMask} request.updateMask - * The [field mask] - * (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) - * of the fields in `agentPool` to update in this request. - * The following `agentPool` fields can be updated: - * - * * {@link google.storagetransfer.v1.AgentPool.display_name|display_name} - * - * * {@link google.storagetransfer.v1.AgentPool.bandwidth_limit|bandwidth_limit} - * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. - * 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/storage_transfer_service.update_agent_pool.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async - */ - updateAgentPool( - request?: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|undefined, {}|undefined - ]>; - updateAgentPool( - request: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - updateAgentPool( - request: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - updateAgentPool( - request?: protos.google.storagetransfer.v1.IUpdateAgentPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IUpdateAgentPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'agent_pool.name': request.agentPool!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAgentPool(request, options, callback); - } -/** - * Gets an agent pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the agent pool to get. - * @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 [AgentPool]{@link google.storagetransfer.v1.AgentPool}. - * 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/storage_transfer_service.get_agent_pool.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async - */ - getAgentPool( - request?: protos.google.storagetransfer.v1.IGetAgentPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|undefined, {}|undefined - ]>; - getAgentPool( - request: protos.google.storagetransfer.v1.IGetAgentPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - getAgentPool( - request: protos.google.storagetransfer.v1.IGetAgentPoolRequest, - callback: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - getAgentPool( - request?: protos.google.storagetransfer.v1.IGetAgentPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool, - protos.google.storagetransfer.v1.IGetAgentPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getAgentPool(request, options, callback); - } -/** - * Deletes an agent pool. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the agent pool to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/storage_transfer_service.delete_agent_pool.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async - */ - deleteAgentPool( - request?: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|undefined, {}|undefined - ]>; - deleteAgentPool( - request: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - deleteAgentPool( - request: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, - {}|null|undefined>): void; - deleteAgentPool( - request?: protos.google.storagetransfer.v1.IDeleteAgentPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.storagetransfer.v1.IDeleteAgentPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAgentPool(request, options, callback); - } - -/** - * Attempts to start a new TransferOperation for the current TransferJob. A - * TransferJob has a maximum of one active TransferOperation. If this method - * is called while a TransferOperation is active, an error will be returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.jobName - * Required. The name of the transfer job. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the transfer - * job. - * @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/storage_transfer_service.run_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async - */ - runTransferJob( - request?: protos.google.storagetransfer.v1.IRunTransferJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runTransferJob( - request: protos.google.storagetransfer.v1.IRunTransferJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runTransferJob( - request: protos.google.storagetransfer.v1.IRunTransferJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runTransferJob( - request?: protos.google.storagetransfer.v1.IRunTransferJobRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'job_name': request.jobName ?? '', - }); - this.initialize(); - return this.innerApiCalls.runTransferJob(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runTransferJob()`. - * @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/storage_transfer_service.run_transfer_job.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async - */ - async checkRunTransferJobProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runTransferJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists transfer jobs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":["jobid1","jobid2",...], - * "jobStatuses":["status1","status2",...]}` - * - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, - * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. - * @param {number} request.pageSize - * The list page size. The max allowed value is 256. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [TransferJob]{@link google.storagetransfer.v1.TransferJob}. - * 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 `listTransferJobsAsync()` - * 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. - */ - listTransferJobs( - request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob[], - protos.google.storagetransfer.v1.IListTransferJobsRequest|null, - protos.google.storagetransfer.v1.IListTransferJobsResponse - ]>; - listTransferJobs( - request: protos.google.storagetransfer.v1.IListTransferJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.storagetransfer.v1.IListTransferJobsRequest, - protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, - protos.google.storagetransfer.v1.ITransferJob>): void; - listTransferJobs( - request: protos.google.storagetransfer.v1.IListTransferJobsRequest, - callback: PaginationCallback< - protos.google.storagetransfer.v1.IListTransferJobsRequest, - protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, - protos.google.storagetransfer.v1.ITransferJob>): void; - listTransferJobs( - request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.storagetransfer.v1.IListTransferJobsRequest, - protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, - protos.google.storagetransfer.v1.ITransferJob>, - callback?: PaginationCallback< - protos.google.storagetransfer.v1.IListTransferJobsRequest, - protos.google.storagetransfer.v1.IListTransferJobsResponse|null|undefined, - protos.google.storagetransfer.v1.ITransferJob>): - Promise<[ - protos.google.storagetransfer.v1.ITransferJob[], - protos.google.storagetransfer.v1.IListTransferJobsRequest|null, - protos.google.storagetransfer.v1.IListTransferJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.listTransferJobs(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.filter - * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":["jobid1","jobid2",...], - * "jobStatuses":["status1","status2",...]}` - * - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, - * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. - * @param {number} request.pageSize - * The list page size. The max allowed value is 256. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [TransferJob]{@link google.storagetransfer.v1.TransferJob} 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 `listTransferJobsAsync()` - * 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. - */ - listTransferJobsStream( - request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listTransferJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTransferJobs.createStream( - this.innerApiCalls.listTransferJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTransferJobs`, 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.filter - * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":["jobid1","jobid2",...], - * "jobStatuses":["status1","status2",...]}` - * - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * {@link google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, - * {@link google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and - * {@link google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. - * @param {number} request.pageSize - * The list page size. The max allowed value is 256. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [TransferJob]{@link google.storagetransfer.v1.TransferJob}. 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/storage_transfer_service.list_transfer_jobs.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async - */ - listTransferJobsAsync( - request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listTransferJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTransferJobs.asyncIterate( - this.innerApiCalls['listTransferJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists agent pools. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud project that owns the job. - * @param {string} request.filter - * An optional list of query parameters specified as JSON text in the - * form of: - * - * `{"agentPoolNames":["agentpool1","agentpool2",...]}` - * - * Since `agentPoolNames` support multiple values, its values must be - * specified with array notation. When the filter is either empty or not - * provided, the list returns all agent pools for the project. - * @param {number} request.pageSize - * The list page size. The max allowed value is `256`. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [AgentPool]{@link google.storagetransfer.v1.AgentPool}. - * 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 `listAgentPoolsAsync()` - * 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. - */ - listAgentPools( - request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - options?: CallOptions): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool[], - protos.google.storagetransfer.v1.IListAgentPoolsRequest|null, - protos.google.storagetransfer.v1.IListAgentPoolsResponse - ]>; - listAgentPools( - request: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.storagetransfer.v1.IListAgentPoolsRequest, - protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, - protos.google.storagetransfer.v1.IAgentPool>): void; - listAgentPools( - request: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - callback: PaginationCallback< - protos.google.storagetransfer.v1.IListAgentPoolsRequest, - protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, - protos.google.storagetransfer.v1.IAgentPool>): void; - listAgentPools( - request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.storagetransfer.v1.IListAgentPoolsRequest, - protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, - protos.google.storagetransfer.v1.IAgentPool>, - callback?: PaginationCallback< - protos.google.storagetransfer.v1.IListAgentPoolsRequest, - protos.google.storagetransfer.v1.IListAgentPoolsResponse|null|undefined, - protos.google.storagetransfer.v1.IAgentPool>): - Promise<[ - protos.google.storagetransfer.v1.IAgentPool[], - protos.google.storagetransfer.v1.IListAgentPoolsRequest|null, - protos.google.storagetransfer.v1.IListAgentPoolsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - }); - this.initialize(); - return this.innerApiCalls.listAgentPools(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.projectId - * Required. The ID of the Google Cloud project that owns the job. - * @param {string} request.filter - * An optional list of query parameters specified as JSON text in the - * form of: - * - * `{"agentPoolNames":["agentpool1","agentpool2",...]}` - * - * Since `agentPoolNames` support multiple values, its values must be - * specified with array notation. When the filter is either empty or not - * provided, the list returns all agent pools for the project. - * @param {number} request.pageSize - * The list page size. The max allowed value is `256`. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [AgentPool]{@link google.storagetransfer.v1.AgentPool} 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 `listAgentPoolsAsync()` - * 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. - */ - listAgentPoolsStream( - request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - }); - const defaultCallSettings = this._defaults['listAgentPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAgentPools.createStream( - this.innerApiCalls.listAgentPools as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAgentPools`, 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.projectId - * Required. The ID of the Google Cloud project that owns the job. - * @param {string} request.filter - * An optional list of query parameters specified as JSON text in the - * form of: - * - * `{"agentPoolNames":["agentpool1","agentpool2",...]}` - * - * Since `agentPoolNames` support multiple values, its values must be - * specified with array notation. When the filter is either empty or not - * provided, the list returns all agent pools for the project. - * @param {number} request.pageSize - * The list page size. The max allowed value is `256`. - * @param {string} request.pageToken - * The list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [AgentPool]{@link google.storagetransfer.v1.AgentPool}. 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/storage_transfer_service.list_agent_pools.js - * region_tag:storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async - */ - listAgentPoolsAsync( - request?: protos.google.storagetransfer.v1.IListAgentPoolsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - }); - const defaultCallSettings = this._defaults['listAgentPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAgentPools.asyncIterate( - this.innerApiCalls['listAgentPools'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified agentPools resource name string. - * - * @param {string} project_id - * @param {string} agent_pool_id - * @returns {string} Resource name string. - */ - agentPoolsPath(projectId:string,agentPoolId:string) { - return this.pathTemplates.agentPoolsPathTemplate.render({ - project_id: projectId, - agent_pool_id: agentPoolId, - }); - } - - /** - * Parse the project_id from AgentPools resource. - * - * @param {string} agentPoolsName - * A fully-qualified path representing agentPools resource. - * @returns {string} A string representing the project_id. - */ - matchProjectIdFromAgentPoolsName(agentPoolsName: string) { - return this.pathTemplates.agentPoolsPathTemplate.match(agentPoolsName).project_id; - } - - /** - * Parse the agent_pool_id from AgentPools resource. - * - * @param {string} agentPoolsName - * A fully-qualified path representing agentPools resource. - * @returns {string} A string representing the agent_pool_id. - */ - matchAgentPoolIdFromAgentPoolsName(agentPoolsName: string) { - return this.pathTemplates.agentPoolsPathTemplate.match(agentPoolsName).agent_pool_id; - } - - /** - * 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.storageTransferServiceStub && !this._terminated) { - return this.storageTransferServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json b/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json deleted file mode 100644 index 93b4537..0000000 --- a/owl-bot-staging/v1/src/v1/storage_transfer_service_client_config.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "interfaces": { - "google.storagetransfer.v1.StorageTransferService": { - "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 - }, - "264268458a9e88347dbacbd9398202ff5885a40b": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 2, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetGoogleServiceAccount": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "CreateTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "GetTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ListTransferJobs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "PauseTransferOperation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ResumeTransferOperation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "RunTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "DeleteTransferJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "CreateAgentPool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "UpdateAgentPool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "GetAgentPool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ListAgentPools": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "DeleteAgentPool": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json b/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json deleted file mode 100644 index ea755b4..0000000 --- a/owl-bot-staging/v1/src/v1/storage_transfer_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/storagetransfer/v1/transfer.proto", - "../../protos/google/storagetransfer/v1/transfer_types.proto" -] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 842da4d..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 storagetransfer = require('@google-cloud/storage-transfer'); - -function main() { - const storageTransferServiceClient = new storagetransfer.StorageTransferServiceClient(); -} - -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 458ee50..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 {StorageTransferServiceClient} from '@google-cloud/storage-transfer'; - -// check that the client class type name can be used -function doStuffWithStorageTransferServiceClient(client: StorageTransferServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const storageTransferServiceClient = new StorageTransferServiceClient(); - doStuffWithStorageTransferServiceClient(storageTransferServiceClient); -} - -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 557a575..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_storage_transfer_service_v1.ts b/owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts deleted file mode 100644 index b782c5b..0000000 --- a/owl-bot-staging/v1/test/gapic_storage_transfer_service_v1.ts +++ /dev/null @@ -1,2242 +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 storagetransferserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.StorageTransferServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = storagetransferserviceModule.v1.StorageTransferServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = storagetransferserviceModule.v1.StorageTransferServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = storagetransferserviceModule.v1.StorageTransferServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.storageTransferServiceStub, undefined); - await client.initialize(); - assert(client.storageTransferServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.storageTransferServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.storageTransferServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - 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 storagetransferserviceModule.v1.StorageTransferServiceClient({ - 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('getGoogleServiceAccount', () => { - it('invokes getGoogleServiceAccount without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetGoogleServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.GoogleServiceAccount() - ); - client.innerApiCalls.getGoogleServiceAccount = stubSimpleCall(expectedResponse); - const [response] = await client.getGoogleServiceAccount(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGoogleServiceAccount without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetGoogleServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.GoogleServiceAccount() - ); - client.innerApiCalls.getGoogleServiceAccount = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGoogleServiceAccount( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IGoogleServiceAccount|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGoogleServiceAccount with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetGoogleServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGoogleServiceAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGoogleServiceAccount(request), expectedError); - const actualRequest = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGoogleServiceAccount with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetGoogleServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getGoogleServiceAccount(request), expectedError); - }); - }); - - describe('createTransferJob', () => { - it('invokes createTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.CreateTransferJobRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.TransferJob() - ); - client.innerApiCalls.createTransferJob = stubSimpleCall(expectedResponse); - const [response] = await client.createTransferJob(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.CreateTransferJobRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.TransferJob() - ); - client.innerApiCalls.createTransferJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTransferJob( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createTransferJob with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.CreateTransferJobRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createTransferJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTransferJob(request), expectedError); - }); - - it('invokes createTransferJob with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.CreateTransferJobRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createTransferJob(request), expectedError); - }); - }); - - describe('updateTransferJob', () => { - it('invokes updateTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.UpdateTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('UpdateTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.TransferJob() - ); - client.innerApiCalls.updateTransferJob = stubSimpleCall(expectedResponse); - const [response] = await client.updateTransferJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.UpdateTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('UpdateTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.TransferJob() - ); - client.innerApiCalls.updateTransferJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTransferJob( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTransferJob with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.UpdateTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('UpdateTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTransferJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateTransferJob(request), expectedError); - const actualRequest = (client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTransferJob with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.UpdateTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('UpdateTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateTransferJob(request), expectedError); - }); - }); - - describe('getTransferJob', () => { - it('invokes getTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.TransferJob() - ); - client.innerApiCalls.getTransferJob = stubSimpleCall(expectedResponse); - const [response] = await client.getTransferJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.TransferJob() - ); - client.innerApiCalls.getTransferJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTransferJob( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTransferJob with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTransferJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTransferJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTransferJob with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getTransferJob(request), expectedError); - }); - }); - - describe('pauseTransferOperation', () => { - it('invokes pauseTransferOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.PauseTransferOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('PauseTransferOperationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.pauseTransferOperation = stubSimpleCall(expectedResponse); - const [response] = await client.pauseTransferOperation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseTransferOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.PauseTransferOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('PauseTransferOperationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.pauseTransferOperation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pauseTransferOperation( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseTransferOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.PauseTransferOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('PauseTransferOperationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseTransferOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pauseTransferOperation(request), expectedError); - const actualRequest = (client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseTransferOperation with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.PauseTransferOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('PauseTransferOperationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.pauseTransferOperation(request), expectedError); - }); - }); - - describe('resumeTransferOperation', () => { - it('invokes resumeTransferOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ResumeTransferOperationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.resumeTransferOperation = stubSimpleCall(expectedResponse); - const [response] = await client.resumeTransferOperation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeTransferOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ResumeTransferOperationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.resumeTransferOperation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resumeTransferOperation( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeTransferOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ResumeTransferOperationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeTransferOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resumeTransferOperation(request), expectedError); - const actualRequest = (client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeTransferOperation with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ResumeTransferOperationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.resumeTransferOperation(request), expectedError); - }); - }); - - describe('deleteTransferJob', () => { - it('invokes deleteTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.DeleteTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTransferJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTransferJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.DeleteTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTransferJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTransferJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTransferJob with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.DeleteTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTransferJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTransferJob(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTransferJob with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.DeleteTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteTransferJob(request), expectedError); - }); - }); - - describe('createAgentPool', () => { - it('invokes createAgentPool without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.CreateAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateAgentPoolRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.AgentPool() - ); - client.innerApiCalls.createAgentPool = stubSimpleCall(expectedResponse); - const [response] = await client.createAgentPool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAgentPool without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.CreateAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateAgentPoolRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.AgentPool() - ); - client.innerApiCalls.createAgentPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAgentPool( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAgentPool with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.CreateAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateAgentPoolRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAgentPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAgentPool(request), expectedError); - const actualRequest = (client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAgentPool with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.CreateAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateAgentPoolRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createAgentPool(request), expectedError); - }); - }); - - describe('updateAgentPool', () => { - it('invokes updateAgentPool without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() - ); - request.agentPool ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateAgentPoolRequest', ['agentPool', 'name']); - request.agentPool.name = defaultValue1; - const expectedHeaderRequestParams = `agent_pool.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.AgentPool() - ); - client.innerApiCalls.updateAgentPool = stubSimpleCall(expectedResponse); - const [response] = await client.updateAgentPool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAgentPool without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() - ); - request.agentPool ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateAgentPoolRequest', ['agentPool', 'name']); - request.agentPool.name = defaultValue1; - const expectedHeaderRequestParams = `agent_pool.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.AgentPool() - ); - client.innerApiCalls.updateAgentPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAgentPool( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAgentPool with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() - ); - request.agentPool ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateAgentPoolRequest', ['agentPool', 'name']); - request.agentPool.name = defaultValue1; - const expectedHeaderRequestParams = `agent_pool.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAgentPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAgentPool(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAgentPool with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() - ); - request.agentPool ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateAgentPoolRequest', ['agentPool', 'name']); - request.agentPool.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateAgentPool(request), expectedError); - }); - }); - - describe('getAgentPool', () => { - it('invokes getAgentPool without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetAgentPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.AgentPool() - ); - client.innerApiCalls.getAgentPool = stubSimpleCall(expectedResponse); - const [response] = await client.getAgentPool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAgentPool without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetAgentPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.storagetransfer.v1.AgentPool() - ); - client.innerApiCalls.getAgentPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAgentPool( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAgentPool with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetAgentPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAgentPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAgentPool(request), expectedError); - const actualRequest = (client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAgentPool with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.GetAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetAgentPoolRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAgentPool(request), expectedError); - }); - }); - - describe('deleteAgentPool', () => { - it('invokes deleteAgentPool without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteAgentPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAgentPool = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAgentPool(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAgentPool without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteAgentPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAgentPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAgentPool( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAgentPool with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteAgentPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAgentPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAgentPool(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAgentPool with closed client', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteAgentPoolRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAgentPool(request), expectedError); - }); - }); - - describe('runTransferJob', () => { - it('invokes runTransferJob without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.RunTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RunTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runTransferJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.runTransferJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runTransferJob without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.RunTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RunTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runTransferJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runTransferJob( - 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); - const actualRequest = (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runTransferJob with call error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.RunTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RunTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runTransferJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runTransferJob(request), expectedError); - const actualRequest = (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runTransferJob with LRO error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.RunTransferJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RunTransferJobRequest', ['jobName']); - request.jobName = defaultValue1; - const expectedHeaderRequestParams = `job_name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runTransferJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runTransferJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRunTransferJobProgress without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - 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.checkRunTransferJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunTransferJobProgress with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - 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.checkRunTransferJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listTransferJobs', () => { - it('invokes listTransferJobs without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListTransferJobsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - ]; - client.innerApiCalls.listTransferJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listTransferJobs(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listTransferJobs without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListTransferJobsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - ]; - client.innerApiCalls.listTransferJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTransferJobs( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.ITransferJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listTransferJobs with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListTransferJobsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listTransferJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTransferJobs(request), expectedError); - }); - - it('invokes listTransferJobsStream without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListTransferJobsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - ]; - client.descriptors.page.listTransferJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTransferJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.storagetransfer.v1.TransferJob[] = []; - stream.on('data', (response: protos.google.storagetransfer.v1.TransferJob) => { - 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.listTransferJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTransferJobs, request)); - }); - - it('invokes listTransferJobsStream with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListTransferJobsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listTransferJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTransferJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.storagetransfer.v1.TransferJob[] = []; - stream.on('data', (response: protos.google.storagetransfer.v1.TransferJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTransferJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTransferJobs, request)); - }); - - it('uses async iteration with listTransferJobs without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListTransferJobsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - generateSampleMessage(new protos.google.storagetransfer.v1.TransferJob()), - ]; - client.descriptors.page.listTransferJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.storagetransfer.v1.ITransferJob[] = []; - const iterable = client.listTransferJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTransferJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listTransferJobs with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListTransferJobsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listTransferJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTransferJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.storagetransfer.v1.ITransferJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTransferJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listAgentPools', () => { - it('invokes listAgentPools without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListAgentPoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - ]; - client.innerApiCalls.listAgentPools = stubSimpleCall(expectedResponse); - const [response] = await client.listAgentPools(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAgentPools without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListAgentPoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - ]; - client.innerApiCalls.listAgentPools = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAgentPools( - request, - (err?: Error|null, result?: protos.google.storagetransfer.v1.IAgentPool[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAgentPools with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListAgentPoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAgentPools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAgentPools(request), expectedError); - const actualRequest = (client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAgentPoolsStream without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListAgentPoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - ]; - client.descriptors.page.listAgentPools.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAgentPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.storagetransfer.v1.AgentPool[] = []; - stream.on('data', (response: protos.google.storagetransfer.v1.AgentPool) => { - 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.listAgentPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAgentPools, request)); - assert( - (client.descriptors.page.listAgentPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAgentPoolsStream with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListAgentPoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAgentPools.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAgentPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.storagetransfer.v1.AgentPool[] = []; - stream.on('data', (response: protos.google.storagetransfer.v1.AgentPool) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAgentPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAgentPools, request)); - assert( - (client.descriptors.page.listAgentPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAgentPools without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListAgentPoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), - ]; - client.descriptors.page.listAgentPools.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.storagetransfer.v1.IAgentPool[] = []; - const iterable = client.listAgentPoolsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAgentPools with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.storagetransfer.v1.ListAgentPoolsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAgentPoolsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAgentPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAgentPoolsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.storagetransfer.v1.IAgentPool[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('agentPools', () => { - const fakePath = "/rendered/path/agentPools"; - const expectedParameters = { - project_id: "projectIdValue", - agent_pool_id: "agentPoolIdValue", - }; - const client = new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.agentPoolsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.agentPoolsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('agentPoolsPath', () => { - const result = client.agentPoolsPath("projectIdValue", "agentPoolIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.agentPoolsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectIdFromAgentPoolsName', () => { - const result = client.matchProjectIdFromAgentPoolsName(fakePath); - assert.strictEqual(result, "projectIdValue"); - assert((client.pathTemplates.agentPoolsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAgentPoolIdFromAgentPoolsName', () => { - const result = client.matchAgentPoolIdFromAgentPoolsName(fakePath); - assert.strictEqual(result, "agentPoolIdValue"); - assert((client.pathTemplates.agentPoolsPathTemplate.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 08a3efc..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: 'StorageTransferService', - filename: './storage-transfer-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/src/v1/storage_transfer_service_client.ts b/src/v1/storage_transfer_service_client.ts index f76cf06..4e4560b 100644 --- a/src/v1/storage_transfer_service_client.ts +++ b/src/v1/storage_transfer_service_client.ts @@ -497,7 +497,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - project_id: request.projectId || '', + project_id: request.projectId ?? '', }); this.initialize(); return this.innerApiCalls.getGoogleServiceAccount( @@ -711,7 +711,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - job_name: request.jobName || '', + job_name: request.jobName ?? '', }); this.initialize(); return this.innerApiCalls.updateTransferJob(request, options, callback); @@ -805,7 +805,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - job_name: request.jobName || '', + job_name: request.jobName ?? '', }); this.initialize(); return this.innerApiCalls.getTransferJob(request, options, callback); @@ -902,7 +902,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.pauseTransferOperation( @@ -1003,7 +1003,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.resumeTransferOperation( @@ -1102,7 +1102,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - job_name: request.jobName || '', + job_name: request.jobName ?? '', }); this.initialize(); return this.innerApiCalls.deleteTransferJob(request, options, callback); @@ -1210,7 +1210,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - project_id: request.projectId || '', + project_id: request.projectId ?? '', }); this.initialize(); return this.innerApiCalls.createAgentPool(request, options, callback); @@ -1319,7 +1319,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'agent_pool.name': request.agentPool!.name || '', + 'agent_pool.name': request.agentPool!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateAgentPool(request, options, callback); @@ -1404,7 +1404,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getAgentPool(request, options, callback); @@ -1495,7 +1495,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteAgentPool(request, options, callback); @@ -1604,7 +1604,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - job_name: request.jobName || '', + job_name: request.jobName ?? '', }); this.initialize(); return this.innerApiCalls.runTransferJob(request, options, callback); @@ -1956,7 +1956,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - project_id: request.projectId || '', + project_id: request.projectId ?? '', }); this.initialize(); return this.innerApiCalls.listAgentPools(request, options, callback); @@ -2003,7 +2003,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - project_id: request.projectId || '', + project_id: request.projectId ?? '', }); const defaultCallSettings = this._defaults['listAgentPools']; const callSettings = defaultCallSettings.merge(options); @@ -2059,7 +2059,7 @@ export class StorageTransferServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - project_id: request.projectId || '', + project_id: request.projectId ?? '', }); const defaultCallSettings = this._defaults['listAgentPools']; const callSettings = defaultCallSettings.merge(options); diff --git a/test/gapic_storage_transfer_service_v1.ts b/test/gapic_storage_transfer_service_v1.ts index e0641c1..dcda10e 100644 --- a/test/gapic_storage_transfer_service_v1.ts +++ b/test/gapic_storage_transfer_service_v1.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -265,15 +280,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'GetGoogleServiceAccountRequest', + ['projectId'] + ); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.GoogleServiceAccount() ); @@ -281,11 +293,14 @@ describe('v1.StorageTransferServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getGoogleServiceAccount(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getGoogleServiceAccount as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGoogleServiceAccount as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getGoogleServiceAccount without error using callback', async () => { @@ -298,15 +313,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'GetGoogleServiceAccountRequest', + ['projectId'] + ); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.GoogleServiceAccount() ); @@ -329,11 +341,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getGoogleServiceAccount as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGoogleServiceAccount as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getGoogleServiceAccount with error', async () => { @@ -346,15 +361,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'GetGoogleServiceAccountRequest', + ['projectId'] + ); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getGoogleServiceAccount = stubSimpleCall( undefined, @@ -364,11 +376,14 @@ describe('v1.StorageTransferServiceClient', () => { client.getGoogleServiceAccount(request), expectedError ); - assert( - (client.innerApiCalls.getGoogleServiceAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getGoogleServiceAccount as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGoogleServiceAccount as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getGoogleServiceAccount with closed client', async () => { @@ -381,7 +396,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetGoogleServiceAccountRequest() ); - request.projectId = ''; + const defaultValue1 = getTypeDefaultValue( + 'GetGoogleServiceAccountRequest', + ['projectId'] + ); + request.projectId = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -402,18 +421,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.CreateTransferJobRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.TransferJob() ); client.innerApiCalls.createTransferJob = stubSimpleCall(expectedResponse); const [response] = await client.createTransferJob(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes createTransferJob without error using callback', async () => { @@ -426,7 +439,6 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.CreateTransferJobRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.TransferJob() ); @@ -449,11 +461,6 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); }); it('invokes createTransferJob with error', async () => { @@ -466,18 +473,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.CreateTransferJobRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.createTransferJob = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createTransferJob(request), expectedError); - assert( - (client.innerApiCalls.createTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes createTransferJob with closed client', async () => { @@ -507,26 +508,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.UpdateTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('UpdateTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.TransferJob() ); client.innerApiCalls.updateTransferJob = stubSimpleCall(expectedResponse); const [response] = await client.updateTransferJob(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateTransferJob without error using callback', async () => { @@ -539,15 +539,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.UpdateTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('UpdateTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.TransferJob() ); @@ -570,11 +566,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateTransferJob with error', async () => { @@ -587,26 +586,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.UpdateTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('UpdateTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateTransferJob = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateTransferJob(request), expectedError); - assert( - (client.innerApiCalls.updateTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateTransferJob with closed client', async () => { @@ -619,7 +617,10 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.UpdateTransferJobRequest() ); - request.jobName = ''; + const defaultValue1 = getTypeDefaultValue('UpdateTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateTransferJob(request), expectedError); @@ -637,26 +638,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.TransferJob() ); client.innerApiCalls.getTransferJob = stubSimpleCall(expectedResponse); const [response] = await client.getTransferJob(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getTransferJob without error using callback', async () => { @@ -669,15 +669,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.TransferJob() ); @@ -700,11 +696,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getTransferJob with error', async () => { @@ -717,26 +716,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getTransferJob = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getTransferJob(request), expectedError); - assert( - (client.innerApiCalls.getTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getTransferJob with closed client', async () => { @@ -749,7 +747,10 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetTransferJobRequest() ); - request.jobName = ''; + const defaultValue1 = getTypeDefaultValue('GetTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getTransferJob(request), expectedError); @@ -767,15 +768,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.PauseTransferOperationRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'PauseTransferOperationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -783,11 +781,14 @@ describe('v1.StorageTransferServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.pauseTransferOperation(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.pauseTransferOperation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseTransferOperation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes pauseTransferOperation without error using callback', async () => { @@ -800,15 +801,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.PauseTransferOperationRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'PauseTransferOperationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -831,11 +829,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.pauseTransferOperation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseTransferOperation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes pauseTransferOperation with error', async () => { @@ -848,15 +849,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.PauseTransferOperationRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'PauseTransferOperationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.pauseTransferOperation = stubSimpleCall( undefined, @@ -866,11 +864,14 @@ describe('v1.StorageTransferServiceClient', () => { client.pauseTransferOperation(request), expectedError ); - assert( - (client.innerApiCalls.pauseTransferOperation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.pauseTransferOperation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseTransferOperation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes pauseTransferOperation with closed client', async () => { @@ -883,7 +884,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.PauseTransferOperationRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + 'PauseTransferOperationRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -904,15 +909,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ResumeTransferOperationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -920,11 +922,14 @@ describe('v1.StorageTransferServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.resumeTransferOperation(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.resumeTransferOperation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeTransferOperation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes resumeTransferOperation without error using callback', async () => { @@ -937,15 +942,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ResumeTransferOperationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -968,11 +970,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.resumeTransferOperation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeTransferOperation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes resumeTransferOperation with error', async () => { @@ -985,15 +990,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ResumeTransferOperationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.resumeTransferOperation = stubSimpleCall( undefined, @@ -1003,11 +1005,14 @@ describe('v1.StorageTransferServiceClient', () => { client.resumeTransferOperation(request), expectedError ); - assert( - (client.innerApiCalls.resumeTransferOperation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.resumeTransferOperation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeTransferOperation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes resumeTransferOperation with closed client', async () => { @@ -1020,7 +1025,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ResumeTransferOperationRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + 'ResumeTransferOperationRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -1041,26 +1050,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.DeleteTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteTransferJob = stubSimpleCall(expectedResponse); const [response] = await client.deleteTransferJob(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteTransferJob without error using callback', async () => { @@ -1073,15 +1081,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.DeleteTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -1104,11 +1108,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteTransferJob with error', async () => { @@ -1121,26 +1128,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.DeleteTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteTransferJob = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteTransferJob(request), expectedError); - assert( - (client.innerApiCalls.deleteTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteTransferJob with closed client', async () => { @@ -1153,7 +1159,10 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.DeleteTransferJobRequest() ); - request.jobName = ''; + const defaultValue1 = getTypeDefaultValue('DeleteTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteTransferJob(request), expectedError); @@ -1171,26 +1180,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.CreateAgentPoolRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateAgentPoolRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.AgentPool() ); client.innerApiCalls.createAgentPool = stubSimpleCall(expectedResponse); const [response] = await client.createAgentPool(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createAgentPool without error using callback', async () => { @@ -1203,15 +1211,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.CreateAgentPoolRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateAgentPoolRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.AgentPool() ); @@ -1234,11 +1238,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createAgentPool with error', async () => { @@ -1251,26 +1258,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.CreateAgentPoolRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateAgentPoolRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createAgentPool = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createAgentPool(request), expectedError); - assert( - (client.innerApiCalls.createAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createAgentPool with closed client', async () => { @@ -1283,7 +1289,10 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.CreateAgentPoolRequest() ); - request.projectId = ''; + const defaultValue1 = getTypeDefaultValue('CreateAgentPoolRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createAgentPool(request), expectedError); @@ -1301,27 +1310,27 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() ); - request.agentPool = {}; - request.agentPool.name = ''; - const expectedHeaderRequestParams = 'agent_pool.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.agentPool ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateAgentPoolRequest', [ + 'agentPool', + 'name', + ]); + request.agentPool.name = defaultValue1; + const expectedHeaderRequestParams = `agent_pool.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.AgentPool() ); client.innerApiCalls.updateAgentPool = stubSimpleCall(expectedResponse); const [response] = await client.updateAgentPool(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAgentPool without error using callback', async () => { @@ -1334,16 +1343,13 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() ); - request.agentPool = {}; - request.agentPool.name = ''; - const expectedHeaderRequestParams = 'agent_pool.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.agentPool ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateAgentPoolRequest', [ + 'agentPool', + 'name', + ]); + request.agentPool.name = defaultValue1; + const expectedHeaderRequestParams = `agent_pool.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.AgentPool() ); @@ -1366,11 +1372,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAgentPool with error', async () => { @@ -1383,27 +1392,27 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() ); - request.agentPool = {}; - request.agentPool.name = ''; - const expectedHeaderRequestParams = 'agent_pool.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.agentPool ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateAgentPoolRequest', [ + 'agentPool', + 'name', + ]); + request.agentPool.name = defaultValue1; + const expectedHeaderRequestParams = `agent_pool.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateAgentPool = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateAgentPool(request), expectedError); - assert( - (client.innerApiCalls.updateAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAgentPool with closed client', async () => { @@ -1416,8 +1425,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.UpdateAgentPoolRequest() ); - request.agentPool = {}; - request.agentPool.name = ''; + request.agentPool ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateAgentPoolRequest', [ + 'agentPool', + 'name', + ]); + request.agentPool.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateAgentPool(request), expectedError); @@ -1435,26 +1448,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetAgentPoolRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAgentPoolRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.AgentPool() ); client.innerApiCalls.getAgentPool = stubSimpleCall(expectedResponse); const [response] = await client.getAgentPool(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAgentPool without error using callback', async () => { @@ -1467,15 +1479,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetAgentPoolRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAgentPoolRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.storagetransfer.v1.AgentPool() ); @@ -1498,11 +1506,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAgentPool with error', async () => { @@ -1515,26 +1526,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetAgentPoolRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAgentPoolRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getAgentPool = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getAgentPool(request), expectedError); - assert( - (client.innerApiCalls.getAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAgentPool with closed client', async () => { @@ -1547,7 +1557,10 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.GetAgentPoolRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetAgentPoolRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getAgentPool(request), expectedError); @@ -1565,26 +1578,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteAgentPoolRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteAgentPool = stubSimpleCall(expectedResponse); const [response] = await client.deleteAgentPool(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteAgentPool without error using callback', async () => { @@ -1597,15 +1609,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteAgentPoolRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -1628,11 +1636,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteAgentPool with error', async () => { @@ -1645,26 +1656,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteAgentPoolRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteAgentPool = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteAgentPool(request), expectedError); - assert( - (client.innerApiCalls.deleteAgentPool as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteAgentPool as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAgentPool as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteAgentPool with closed client', async () => { @@ -1677,7 +1687,10 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.DeleteAgentPoolRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteAgentPoolRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteAgentPool(request), expectedError); @@ -1695,15 +1708,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.RunTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RunTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1712,11 +1721,14 @@ describe('v1.StorageTransferServiceClient', () => { const [operation] = await client.runTransferJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.runTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes runTransferJob without error using callback', async () => { @@ -1729,15 +1741,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.RunTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RunTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1767,11 +1775,14 @@ describe('v1.StorageTransferServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.runTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes runTransferJob with call error', async () => { @@ -1784,26 +1795,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.RunTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RunTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.runTransferJob = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.runTransferJob(request), expectedError); - assert( - (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.runTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes runTransferJob with LRO error', async () => { @@ -1816,15 +1826,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.RunTransferJobRequest() ); - request.jobName = ''; - const expectedHeaderRequestParams = 'job_name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RunTransferJobRequest', [ + 'jobName', + ]); + request.jobName = defaultValue1; + const expectedHeaderRequestParams = `job_name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.runTransferJob = stubLongRunningCall( undefined, @@ -1833,11 +1839,14 @@ describe('v1.StorageTransferServiceClient', () => { ); const [operation] = await client.runTransferJob(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.runTransferJob as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.runTransferJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runTransferJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRunTransferJobProgress without error', async () => { @@ -1895,7 +1904,6 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListTransferJobsRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage( new protos.google.storagetransfer.v1.TransferJob() @@ -1910,11 +1918,6 @@ describe('v1.StorageTransferServiceClient', () => { client.innerApiCalls.listTransferJobs = stubSimpleCall(expectedResponse); const [response] = await client.listTransferJobs(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listTransferJobs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes listTransferJobs without error using callback', async () => { @@ -1927,7 +1930,6 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListTransferJobsRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage( new protos.google.storagetransfer.v1.TransferJob() @@ -1958,11 +1960,6 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listTransferJobs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); }); it('invokes listTransferJobs with error', async () => { @@ -1975,18 +1972,12 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListTransferJobsRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.listTransferJobs = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listTransferJobs(request), expectedError); - assert( - (client.innerApiCalls.listTransferJobs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes listTransferJobsStream without error', async () => { @@ -2151,15 +2142,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListAgentPoolsRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListAgentPoolsRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), @@ -2168,11 +2155,14 @@ describe('v1.StorageTransferServiceClient', () => { client.innerApiCalls.listAgentPools = stubSimpleCall(expectedResponse); const [response] = await client.listAgentPools(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listAgentPools as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAgentPools as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listAgentPools without error using callback', async () => { @@ -2185,15 +2175,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListAgentPoolsRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListAgentPoolsRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), @@ -2218,11 +2204,14 @@ describe('v1.StorageTransferServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listAgentPools as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAgentPools as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listAgentPools with error', async () => { @@ -2235,26 +2224,25 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListAgentPoolsRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListAgentPoolsRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listAgentPools = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listAgentPools(request), expectedError); - assert( - (client.innerApiCalls.listAgentPools as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listAgentPools as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAgentPools as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listAgentPoolsStream without error', async () => { @@ -2267,8 +2255,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListAgentPoolsRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + const defaultValue1 = getTypeDefaultValue('ListAgentPoolsRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), @@ -2299,11 +2290,12 @@ describe('v1.StorageTransferServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listAgentPools, request) ); - assert.strictEqual( - ( - client.descriptors.page.listAgentPools.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listAgentPools.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2317,8 +2309,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListAgentPoolsRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + const defaultValue1 = getTypeDefaultValue('ListAgentPoolsRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listAgentPools.createStream = stubPageStreamingCall(undefined, expectedError); @@ -2344,11 +2339,12 @@ describe('v1.StorageTransferServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listAgentPools, request) ); - assert.strictEqual( - ( - client.descriptors.page.listAgentPools.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listAgentPools.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2362,8 +2358,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListAgentPoolsRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + const defaultValue1 = getTypeDefaultValue('ListAgentPoolsRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), generateSampleMessage(new protos.google.storagetransfer.v1.AgentPool()), @@ -2383,11 +2382,12 @@ describe('v1.StorageTransferServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listAgentPools.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2401,8 +2401,11 @@ describe('v1.StorageTransferServiceClient', () => { const request = generateSampleMessage( new protos.google.storagetransfer.v1.ListAgentPoolsRequest() ); - request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + const defaultValue1 = getTypeDefaultValue('ListAgentPoolsRequest', [ + 'projectId', + ]); + request.projectId = defaultValue1; + const expectedHeaderRequestParams = `project_id=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listAgentPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -2419,11 +2422,12 @@ describe('v1.StorageTransferServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listAgentPools.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listAgentPools.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); });